C sharp - movimiento de imagen

 
Vista:

movimiento de imagen

Publicado por julio (5 intervenciones) el 09/06/2009 20:46:06
aca le spongo un codigo que mueve una imagen segun el ancho del form al igual que su altura solo que no entiendo pork en esta linea se tiene que hacer una suma abra manera de hacerlo sin esta suma
if (pictureBox1.Location.X + 15

ahora si el codigo, si alguienm tiene otra manera agradeceria el aporte.
*****************************************************************************************************
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();

}



private void timer1_Tick(object sender, EventArgs e)
{
y1 = pictureBox1.Location.Y;
x1 = pictureBox1.Location.X;
x1 = d1 == true ? x1 += 3 : x1 -=3;
if (pictureBox1.Location.X + 15 > (this.Size.Width-pictureBox1.Width))
{ d1 = false; }
if (pictureBox1.Location.X <5)
{ d1 = true; }
y1 = ab == true ? y1 += 3 : y1 -= 3;
if (pictureBox1.Location.Y +40 > (this.Size.Height-pictureBox1.Size.Height))
{ ab = false; }
if (pictureBox1.Location.Y < 7)
{ ab = true; }

pictureBox1.Location = new Point(x1, y1);
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder