-2

I have placed my Picture Box in the center of my Form, but I don't know how to make it move with the use of buttons.

I need to use a Class Library in the process, so my guess is that using if structure is out of the question?

NomadTraveler
  • 1,086
  • 1
  • 12
  • 37
Exios Lucros
  • 1
  • 1
  • 1
  • What Class Library? Why the "need"? Is this homework? What you have tried so far? – Idle_Mind Oct 21 '13 at 05:14
  • well I have tried noting, I am kind of new to this and yes this is homework but I don't know were to start or what to implement in the C# Class Library that is going to be use as a reference for the Tester AKA: Window form application. – Exios Lucros Oct 21 '13 at 05:20
  • We don't know what to implement in the Class Library either since we can't see the requirements of your homework. We need more ***SPECIFIC DETAILS*** if you want some guidance. – Idle_Mind Oct 21 '13 at 05:22
  • Like what kind of details. If its as to what to do, is to make a Source code within the Class library that when added to the C# Windows form application and then start the debug process the four buttons will make my Picture Box move across the form. One button to make it go up another to make it go down and the other tow to make it go to the sides. – Exios Lucros Oct 21 '13 at 05:32
  • @Idle_Mind pleas read the comment above maybe you will understand I bit better if not tell me I am trying to be as specific as I can be. – Exios Lucros Oct 21 '13 at 05:58
  • Not sure I understand your use of the term "Class Library". Are you just talking about the code for the Form itself? Or do you have to create a SEPARATE Class to handle the move code? – Idle_Mind Oct 21 '13 at 06:03

1 Answers1

0

Make a picture box and a button

This code for the click of a button should move your box 10 left of its current position:

private void button1_Click(object sender, EventArgs e)
{
    this.pictureBox1.Left = this.pictureBox1.Left - 10;
}

You can also use this.pictureBox1.Top to move it vertically.

Make it an addition to .Left or .Top to make it go the opposite direction.

That should give you a nice start!

Elder Taylor
  • 53
  • 1
  • 1
  • 6