【发布时间】:2011-08-09 05:10:41
【问题描述】:
我需要获取表单上的光标位置,我该怎么做?
【问题讨论】:
标签: delphi delphi-7 cursor-position
我需要获取表单上的光标位置,我该怎么做?
【问题讨论】:
标签: delphi delphi-7 cursor-position
将Mouse.CursorPos 传递给TForm.ScreenToClient()。
Mouse.CursorPos 在屏幕坐标系中返回。 TForm.ScreenToClient() 将点转换为表单的客户端坐标系。
事实上,所有 TControl 后代都提供 ScreenToClient() 方法及其逆方法 ClientToScreen(),用于在坐标系之间进行转换。
【讨论】:
CalcCursorPos 方法缩短它,该方法在定义TForm 后代的单元中变为不受保护。这种方法甚至在 Delphi 7 中也存在...