Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Looking for C# help plz

Name: Anonymous 2012-05-18 11:30

I am looking to Move a pictureBox inside a panel without it leaving the Bounds of it. So far I have this code which only prevents it from leaving the pictureBox1.Top & pictureBox1.Left.

Here is the code, please help me finish it:

int x;
int y;

private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                panel1.Left += (e.X - x);
                panel1.Top += (e.Y - y);
            }
        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                x = e.X;
                y = e.Y;
            }
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (pictureBox1.Left + (e.X - x) > 0)
                        pictureBox1.Left += (e.X - x);

                if (pictureBox1.Top + (e.Y - y) > 0)
                        pictureBox1.Top += (e.Y - y);


            }

        }

Name: Anonymous 2012-05-18 12:07

>>10
Read the fucking documentation you stupid piece of shit.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List