Move Picturebox within its parent

S

sam

Hello,
I am looking for a way to move around (drag/drop) a picturebox
placed in a panel like the capability provided during the design time.
The movement is only confined to its parent- the panel. Just not able
to find a resource out there. Any pointer would be great!!

Thanks,
Sam.
 
S

Sanjeevakumar Hiremath

This gives a general idea of going about your problem. You need to optimize
and use some mathematical(micro) adjustments for making it work flawlessly..
I have done the similar implementation in one of my previous assignments.
This should give you a good poit to start.

Hope this is helpful.

private void pictureBox1_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if ( e.Button == MouseButtons.Left )
{
this.pictureBox1.Location = new Point(e.X,e.Y);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top