Get cursor position with respect to the control - C#

前端 未结 11 2340
迷失自我
迷失自我 2020-12-05 23:23

I want to get the mouse position with respect to the control in which mouse pointer is present. That means when I place the cursor to the starting point (Top-Left corner) of

11条回答
  •  失恋的感觉
    2020-12-05 23:56

    Use Control.PointToClient to convert a point from screen-relative coords to control-relative coords. If you need to go the other way, use PointToScreen.

提交回复
热议问题