Hi,
I'm trying to drag and drop onto a Panel on my form. The panel is inside
a groupBox, which of course is inside my form.
When dropping the item onto my Panel, I want it to appear at that point
on the Panel, and therefore need the mouse coordinates relative to the
Panel and not the form itself. Something like:
private void myPanel_DragDro p(object sender, DragEventArgs e)
{
tempPoint = //insert location finding code here...
draggedLabe.Tex t = (string) e.Data.GetData( DataFormats.Tex t);
draggedLabel.Lo cation = tempPoint;
myPanel.Control s.Add(draggedLa bel);
}
I've tried doing this by taking the DragEventArgs mouse coords and
subtracting the panel's location and the groupBox's location, but still
no dice.
I've also tried using:
(Point) (visPanel.Locat ion + (Size) (PointToScreen( Point.Empty) - (Size)
Location));
Which should give the mouse coords relative to my control, but it
doesn't refresh for some reason.
Any simple solutions? I've googled for ages...
Cheers,
-robin
reverse my username to email me.