百
百事
Unregistered / Unconfirmed
GUEST, unregistred user!
我在这里多说几句,所谓静态生成的时候就是一次就把点描完成曲线,动态的话就要求是
过几秒描绘一个点,连成曲线,要在很长的时间才能把所有的点描绘完!
谢谢大家了,请指教!!!
procedure TForm1.Button1Click(Sender: TObject);
var x,y:integer;
begin
if pagecontrol1.TabIndex=0
then
//动态实现方案
begin
with adotable1, image1.Canvas do
begin
Open;
First;
Moveto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
if not Eof
then
begin
timer1.Enabled:=true;
timer1.Interval:=1000;
end;
end;
end
else
//静态实现方案
begin
adotable1.Open;
adotable1.First;
x:=(adotable1.fieldbyname('时间').AsInteger)div(3);
y:=261-adotable1.fieldbyname('心率').AsInteger;
image2.Canvas.MoveTo(0,y+random(3));
image2.Canvas.LineTo(x,y);
with adotable1, image2.Canvas do
begin
Open;
First;
Moveto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
while not Eof do
begin
Next;
lineto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
end;
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
with adotable1, image1.Canvas do
begin
next;
if not Eof then
begin
image1.Canvas.LineTo((adotable1.fieldbyname('时间').AsInteger)div(3),261-adotable1.fieldbyname('心率').AsInteger);
end else
timer1.Enabled:=False;
end;
end;
end.
过几秒描绘一个点,连成曲线,要在很长的时间才能把所有的点描绘完!
谢谢大家了,请指教!!!
procedure TForm1.Button1Click(Sender: TObject);
var x,y:integer;
begin
if pagecontrol1.TabIndex=0
then
//动态实现方案
begin
with adotable1, image1.Canvas do
begin
Open;
First;
Moveto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
if not Eof
then
begin
timer1.Enabled:=true;
timer1.Interval:=1000;
end;
end;
end
else
//静态实现方案
begin
adotable1.Open;
adotable1.First;
x:=(adotable1.fieldbyname('时间').AsInteger)div(3);
y:=261-adotable1.fieldbyname('心率').AsInteger;
image2.Canvas.MoveTo(0,y+random(3));
image2.Canvas.LineTo(x,y);
with adotable1, image2.Canvas do
begin
Open;
First;
Moveto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
while not Eof do
begin
Next;
lineto((fieldbyname('时间').AsInteger)div(3),261-fieldbyname('心率').AsInteger);
end;
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
with adotable1, image1.Canvas do
begin
next;
if not Eof then
begin
image1.Canvas.LineTo((adotable1.fieldbyname('时间').AsInteger)div(3),261-adotable1.fieldbyname('心率').AsInteger);
end else
timer1.Enabled:=False;
end;
end;
end.