Hello everyone!
I am using C # windows application.
I have one picture in the form. When the program starts, the picture should move from right to left, then from left to right, and that's as long as the program works. The dimensions of my form are: 816; 488.
I have that code BUT it only goes right and stops. :(
That's why I created 2 timers.
What I have tried:
public partial class Form1 : Form
{
int x = 408, y = 244;
void goBack(int x)
{
if (x >= 1)
{
x--;
timerleft.Start();
}
else
return;
goBack(x);
}
private void Form1_Load(object sender, EventArgs e)
{
timeFirst.Interval = 1;
timerleft.Interval = 1;
timeFirst.Start();
timerleft.Start();
}
private void timeFirst_Tick(object sender, EventArgs e)
{
lblanvanum.SetBounds(x, y, 408, 244);
x++;
if (x > 700)
{
timeFirst.Stop();
goBack(x);
}
}
}