怎样获取鼠标在memo中点击时的坐标位置? 怎样获取鼠标在memo中点击时的坐标位置:X,Y,Z 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit ClientToScreenU;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Memo1: TMemo; Label1: TLabel; Label2: TLabel; Label3: TLabel; procedure Memo1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var Coords: TPoint; // holds the point being convertedbegin {indicate the clicked coordinates relative to the child window} Label1.Caption := 'Memo Coordinates: '+IntToStr(X)+', '+IntToStr(Y); {convert these coordinates into screen coordinates} Coords := Point(X, Y); Windows.ClientToScreen(Memo1.Handle, Coords); {display the clicked coordinates relative to the screen} Label2.Caption := 'Screen Coordinates: '+IntToStr(Coords.X)+', '+ IntToStr(Coords.Y); {convert the coordinates into window client coordinates} Windows.ScreenToClient(Form1.Handle, Coords); {display the clicked coordinates relative to the client area of the window} Label3.Caption := 'Form Coordinates: '+IntToStr(Coords.X)+', '+ IntToStr(Coords.Y);end;end. 那就是光标位置var p:Tpoint;GetCaretPos(p); 编译通过了,为什么运行的时候就出错,停在 png保存到access中被加密,现解密了一部分,找一个高手来解完!如果ok付2K现金 有关SQL语句的问题! FastReport字体设置问题,,,,你遇到过吗? 如何打印webbrowser中的内容 各位高手们,帮帮忙! 您好,请教这个错误怎么处理? 谢谢 delphi的Code Insight是如何 啥叫上线文件? 关于播放器的初级问题 关于报表设计的一个问题,请大虾们指教!谢谢!在线等... 我想建一个反日联盟论坛!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Coords: TPoint; // holds the point being converted
begin
{indicate the clicked coordinates relative to the child window}
Label1.Caption := 'Memo Coordinates: '+IntToStr(X)+', '+IntToStr(Y); {convert these coordinates into screen coordinates}
Coords := Point(X, Y);
Windows.ClientToScreen(Memo1.Handle, Coords); {display the clicked coordinates relative to the screen}
Label2.Caption := 'Screen Coordinates: '+IntToStr(Coords.X)+', '+
IntToStr(Coords.Y); {convert the coordinates into window client coordinates}
Windows.ScreenToClient(Form1.Handle, Coords); {display the clicked coordinates relative to the client area of the window}
Label3.Caption := 'Form Coordinates: '+IntToStr(Coords.X)+', '+
IntToStr(Coords.Y);
end;end.
var p:Tpoint;
GetCaretPos(p);