I make a lab on programming in high school, I need help. Label moves on the edges of the form in a clockwise direction. With the Checkbox marked on the second form, the label should move and with the unmarked one it should stand still.
public partial class Form1: Form
{ enum Direction { Right, Down, Left, Up }; Direction direction = Direction.Right; public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { switch (direction) { case Direction.Right: label1.Left += 10; break; case Direction.Down: label1.Top += 10; break; case Direction.Left: label1.Left -= 10; break; case Direction.Up: label1.Top -= 10; break; } if (label1.Left > ClientRectangle.Width - label1.Width) { direction = Direction.Down; label1.Left = ClientRectangle.Width - label1.Width; } if (label1.Top > ClientRectangle.Height - label1.Height) { direction = Direction.Left; label1.Top = ClientRectangle.Height - label1.Height; } if (label1.Left < 0) { direction = Direction.Up; label1.Left = 0; } if (label1.Top < 0) { direction = Direction.Right; label1.Top = 0; Tell me how this can be implemented.
if (checkBox1.Checked){ //Do something }, or generally exit the methodif (checkBox1.Checked) return;. Well, in general, have you ever tried anything? How do we find out from the submitted data how and what works there for you and what exactly do you want? - EvgeniyZtimer1_Tick, then you have a timer somewhere, timers usually have Start / Stop methods, then maketimer1.Stop();. - EvgeniyZ