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

Pages: 1-

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 11:31

use LISP then read SICP

Name: Anonymous 2012-05-18 11:33

srry I can't anon.

bumping for C# help

Name: Anonymous 2012-05-18 11:38

This has been covered in SICP.

Name: Anonymous 2012-05-18 11:38

I read that .Bottom & .Right is read only, so this can't be done usng the code I posted.

Someone got any ideas or code that will do this for me?

Name: Anonymous 2012-05-18 11:43

Yes I understand it was covered in SICP, but I can only write this in C#

Name: Anonymous 2012-05-18 11:53

>>6
You should write a Scheme interpreter in C# then.

Name: Anonymous 2012-05-18 11:58

>>7
is it even possible to move a pictureBox within a panel without it leaving its borders, because no matter what I google, I can't find a single snippet of code telling me how to accomplish this

Name: Anonymous 2012-05-18 12:00

>>8
because no matter what I google, I can't find a single snippet of code telling me how to accomplish this
Stop being a copy-and-paste-(from-tutorials) coder.

Name: Anonymous 2012-05-18 12:06

>>9
I'm not.
I want a snippet of code to learn from it. Couldn't care less if it was C++ or VB. I just want to learn the coding behind How to do it.

Name: Anonymous 2012-05-18 12:07

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

Name: Anonymous 2012-05-18 12:10

>>11
if anyone read the complete documentation on a computer language, there would be no need to ask questions you fucking retard

Name: Anonymous 2012-05-18 12:39

>>12
You read the documentation relevant to the fucking problem you stupid piece of shit, I can't believe I have to tell you this it's fucking common sense.

Name: Anonymous 2012-05-18 16:08

>>13
dude just nerds read documentation, i just ask faggots like you on irc

Name: Anonymous 2012-05-18 18:26

>>14
No.

Name: Anonymous 2012-05-18 20:44

>>15
lol the faggots mad, dont worry, your easily replaceable

Name: Anonymous 2012-05-21 11:14

typical .NET fucktard

Name: bampu pantsu 2012-05-29 5:02

bampu pantsu

Name: Sgt.Kabuꁼ滓kiman㰝疏 2012-05-29 13:33

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

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