|
-
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.
-
November 11th, 2011, 12:53 PM
#2
Re: Dragging picturebox , hides behind panel
Try adding the pictureBox to the Panel.Controls so that it is shown inside it. Maybe they are set as part of the forms Controls.
Did you try Panel.SendToBack()? Not sure if it would have a different effect as the pictureBox BringToFront... but it's worth trying.
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
|