H
husion
Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码: procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin drawing:=true; if(drawing)then begin paintbox1.Canvas.Pen.Color:=clyellow; if(x>=length(Y_Values))then begin paintbox1.Canvas.MoveTo(Max_Y_Values.x ,Max_Y_Values.y ); paintbox1.Canvas.LineTo(x,y); setlength(Y_Values,x); Max_Y_Values.x:=x; Max_Y_Values.y:=y; end else begin paintbox1.Canvas .moveto(x,Y_Values[x]); paintbox1.Canvas .lineto(x,y); end; end; procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if ((X>=0) and (X <=512)) and ((Y>=0) and (Y <=350)) then begin label1.Caption :='X:'+inttostr(x)+' Y:'+inttostr; if drawing then begin Y_Values[x]:=y; Timer1.Enabled :=true; end; end; end; procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin 扫描屏幕,并得到整个屏幕的像素点,放在数组Y_Values[x]:=y end; procedure TForm1.Timer1Timer(Sender: TObject); var i:word; begin paintbox1.Refresh; image1.Picture.Bitmap.LoadFromFile('1.bmp');//整个屏幕擦除 paintbox1.Canvas.MoveTo(Zero ,Y_Values[Zero] ); for i:=1 to Max_Y_Values.x do begin paintbox1.Canvas.LineTo(i,Y_Values); end; end; 问题:鼠标移动快,捕捉到的点太少,而且鼠标按下移动过程只能看到很闪的波形,等鼠标停下来的时候,只剩下一个被擦除了的屏幕,没有波形。请高手们提提建议。。。这是实现这个画图的视频http://www.56.com/u65/v_NDUyNjk4OTQ.html