How to get mouse position over a certain control

14,518

Try Control.PointToClient and Control.PointToScreen.

Share:
14,518
Dustin Brooks
Author by

Dustin Brooks

Updated on June 12, 2022

Comments

  • Dustin Brooks
    Dustin Brooks almost 2 years

    Windows Form
    I'm using the DragOver event on a layoutpanel and the DragEventArgs returns the X/Y coordinates of the mouse in relation to the screen. I know there is a function to translate this in to the position of the mouse over the control, but I'm having difficulty locating it.

  • theJerm
    theJerm about 11 years
    This answer could be improved with the code sample being put here instead of a link away.
  • mqp
    mqp about 11 years
    Well you can feel free to edit it and put that code sample right in.
  • theJerm
    theJerm about 11 years
    I haven't figured out what the code should be yet or I would :)