|
-
November 10th, 2011, 09:26 AM
#1
Dragging picturebox , hides behind panel
Hello , i want drag and drop to my form , i have some pictureboxes and i want to drag them over the form.
Code:
private bool isDragging = false;
private int currentX, currentY;
private void brown_pictureBox_MouseDown(object sender, MouseEventArgs e)
{
isDragging = true;
currentX = e.X;
currentY = e.Y;
brown_pictureBox.BringToFront();
}
private void brown_pictureBox_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
brown_pictureBox.Top = brown_pictureBox.Top + (e.Y - currentY);
brown_pictureBox.Left = brown_pictureBox.Left + (e.X - currentX);
}
}
private void brown_pictureBox_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
i use this code and it works very good , now i have a problem , i placed the pictureboxes inside a panel and now when i drag them out of it , the pictureboxes hides behind the panel.....
i tried brown_pictureBox.BringToFront(); but nothing happened.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|