R
Robin Senior
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_DragDrop(object sender, DragEventArgs e)
{
tempPoint = //insert location finding code here...
draggedLabe.Text = (string) e.Data.GetData(DataFormats.Text);
draggedLabel.Location = tempPoint;
myPanel.Controls.Add(draggedLabel);
}
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.Location + (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.
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_DragDrop(object sender, DragEventArgs e)
{
tempPoint = //insert location finding code here...
draggedLabe.Text = (string) e.Data.GetData(DataFormats.Text);
draggedLabel.Location = tempPoint;
myPanel.Controls.Add(draggedLabel);
}
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.Location + (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.