I have a picturebox and I only move it to the right and left, but I would like it when the end of the image reaches the edge of the form and the start, it is no longer possible to move it.
This is how it works:
I would like it to look like this:
The following is the scrpit used:
private void imagemPictureBox_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button==MouseButtons.Left)
{
x = e.X;
}
}
private void imagemPictureBox_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
imagemPictureBox.Left += (e.X - x);
}
}