我想在image上实现像股票一样鼠标跟随的十字线效果,请高手帮忙? 我想实现程序的 image 加载一个图片,然后鼠标像股票软件那种跟随十字线效果,请问如何实现呢?有人能帮帮我吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 取鼠标位置,水平和垂直画线movetolineto procedure TfrmMain.PaintBoxCMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); Procedure DrawCross(AX, AY: Integer); begin With PaintBoxC.Canvas do begin Pen.Color := CrossColor; Pen.Style := CrossStyle; Pen.Mode := pmXor; Pen.Width := 1; MoveTo(AX, 0); LineTo(AX, PaintBoxC.Height); MoveTo(0, AY); LineTo(PaintBoxC.Width, AY); TextOut(5,5,'('+IntTostr(AX)+','+IntTostr(AY)+')'); end; end;Var tmpX, tmpY: Double;begin if (OldX <> -1) then begin DrawCross(OldX, OldY); { draw old crosshair } OldX := -1; end; //PaintBoxC.Canvas. { check if mouse is inside Chart rectangle } if PtInRect(Rect(0, 0, PaintBoxC.Width, PaintBoxC.Height), Point(X, Y)) then begin DrawCross(X, Y); { draw crosshair at current position } { store old position } OldX := X; OldY := Y; end; 新人求助!delphi文件问题 请问IdTcpServer+自带Pooler支持多少客户端链接啊? dbgrid问题 一个特别烦心的问题!高手进来看看! delphi打开GSM MODEM设备出错(USB接口) 请xiufengy(石破天) 进来收! 如何将real类型的数据转换成integer类型? 带参数(传递字符串)调用dll文件中函数的问题 sockconnection断开连接 updatesql问题 delphi ado 2000条数据批量插入mysql中,需要1分钟,如何提高速度? delphi如何设置按ctrl+鼠标左键移动窗体 新建窗体
moveto
lineto
X, Y: Integer); Procedure DrawCross(AX, AY: Integer);
begin
With PaintBoxC.Canvas do
begin
Pen.Color := CrossColor;
Pen.Style := CrossStyle;
Pen.Mode := pmXor;
Pen.Width := 1;
MoveTo(AX, 0);
LineTo(AX, PaintBoxC.Height);
MoveTo(0, AY);
LineTo(PaintBoxC.Width, AY);
TextOut(5,5,'('+IntTostr(AX)+','+IntTostr(AY)+')');
end;
end;Var
tmpX, tmpY: Double;
begin
if (OldX <> -1) then
begin
DrawCross(OldX, OldY); { draw old crosshair }
OldX := -1;
end;
//PaintBoxC.Canvas.
{ check if mouse is inside Chart rectangle }
if PtInRect(Rect(0, 0, PaintBoxC.Width, PaintBoxC.Height), Point(X, Y)) then
begin
DrawCross(X, Y); { draw crosshair at current position }
{ store old position }
OldX := X;
OldY := Y;
end;