How do I to get the current cell position x and y in a DataGridView?

后端 未结 4 927
情深已故
情深已故 2020-12-31 07:24

I have a Windows form with a calendar which is hidden. I want to show the form right under the current cell of a DataGridView. The position changes according to the position

4条回答
  •  萌比男神i
    2020-12-31 07:28

    You may try

    [DllImport("user32.dll", EntryPoint = "GetCursorPos")]
    private static extern bool GetCursorPos(out Point lpPoint);
    

    and call method as

    Point pt;
    GetCursorPos(out pt);
    

    pt will provide x and y.

提交回复
热议问题