0
Sorry for the C# code; I hadn't noticed what forum this was on, but I'm sure you can translate all that in VB.NET
0
Is this forum for C# or Visual Basic?
0
Be sure to also look at the recommended articles listed in the right side of the forum windows.
0
Here is a very ugly implementation (I don't have the time to make it performant), but you can get the idea of how it works.
private bool panelIsGrabbed = false; private int xDistance, yDistance;
private void panel1_MouseDown(object sender, MouseEventArgs e) { xDistance = panel1.Location.X - e.X; yDistance = panel1.Location.Y - e.Y; panelIsGrabbed = true; }
private void panel1_MouseMove(object sender, MouseEventArgs e) { if (panelIsGrabbed) { panel1.Location = new Point(e.X + xDistance, e.Y + yDistance); } }
private void panel1_MouseUp(object sender, MouseEventArgs e) { panelIsGrabbed = false; }
|