Steve,
The simple way to just move the picture by clicking is:
// Define a location before move
int x;
int y;
// Storing begin point (by the left click)
void pictureBox_MouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
x = e.X;
y = e.Y;
} }
// Moving the picture
void pictureBox_MouseMove(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
pictureBox1.Left += (e.X - x);
pictureBox1.Top += (e.Y - y);
} }
Alex
http://devkids.blogspot.com
> Hi All,
> I have a pictureBox control inside of a panel control. The pictureBox
> is
> larger than the panel control and I have the panel control set true
> for
> AutoScroll so the panel displays scrolling bars.
> I would like the user to be able to click and drag the image and for
> it to move around within the panel control.
>
> How would I do this?
>
> Cheers,
> Steve