Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在表单上获取光标位置,我该怎么做?
传给. Mouse.CursorPos_TForm.ScreenToClient()
Mouse.CursorPos
TForm.ScreenToClient()
Mouse.CursorPos在屏幕坐标系中返回。TForm.ScreenToClient()将点转换为表单的客户端坐标系。
事实上,所有 TControl 后代都提供了在坐标系之间进行转换的ScreenToClient()方法及其逆方法。ClientToScreen()
ScreenToClient()
ClientToScreen()