For Programmers: Free Programming Magazines  


Home > Archive > C# > January 2005 > Dropping on Panel in Mouse Location









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Dropping on Panel in Mouse Location
bri

2005-01-30, 8:56 am

How can I create a control at the mouse location within a panel? I have
the dragdrop and the creating of the control working, but I can't seem
to find the location of the mouse relative to the panel.

Doing this gives me the cursor realtive to the screen (or point to the
client), but is skewed relative to the space in the panel:

private void pWorkspace_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
Radio.Radio r = new Radio.Radio();
r.ContextMenu = this.contextMenu1;
pWorkspace.Controls.Add(r);
r.Location = new Point( p.X - pson.X, p.Y - pson.Y );
this.Invalidate();

}
Thanks,
Brian

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com