Get cursor position with respect to the control - C#

前端 未结 11 2345
迷失自我
迷失自我 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:48

    private void panel1_MouseMove(object sender, MouseEventArgs e)
    {
        Text = panel1.PointToClient(Cursor.Position).ToString();    
    } 
    

提交回复
热议问题