Reputation: 2591
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.
Upvotes: 9
Views: 15098
Reputation: 6685
Try using PointToClient
method to compute the location of the specified screen point into client coordinates.
private void DragDrop(object sender, DragEventArgs e)
{
Point point = this.PointToClient(new Point(e.X, e.Y));
// then use point.X and point.Y instead of e.X and e.Y
}
Upvotes: 0