怎样获取鼠标在memo中点击时的坐标位置:X,Y,Z
解决方案 »
- 我要怎么获取用鼠标左键选定的memo里面的长字符串?
- 重分求救,为什么我的Delphi IDE不能像这张官方截图那样美?
- Qry2AID.Text:=Query1BID.Text; 取不到值????
- 系统是2003 在Delphi中为什么找不到Microsoft.Jet.OLEDB.4.0驱动呢?
- 在执行过ADOQuery.Delete;语句后,记录会自动下移一条,这时数据操作已经提交了吗?
- 我要结贴子,怎么做啊?
- 急,用TADOTable控件怎么对字段进行查询?请举例说明!谢谢!
- dbgrideh实现复杂表头(真的很复杂的!!!!!)
- 怎样确认打印机是否准备好了(在报表打印前), 如果好了就打印, 不好就显示消息
- 求打印数据库的控件
- 关于报表设计的一个问题,请大虾们指教!谢谢!在线等...
- 我想建一个反日联盟论坛!
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);