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?
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?
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!