etiqueta en movimiento

 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        bool band = true;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (label1.Left < this.ClientSize.Width - label1.Width + 10 && band)
            {
                label1.Left++;
                if (label1.Left == this.ClientSize.Width - label1.Width - 10)
                {
                    band = false;
                }
            }


            if (label1.Left > -10 && !band)
            {
                label1.Left--;
                if (label1.Left == -10)
                {
                    band = true;
                }
            }
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Start();
            label1.RightToLeft.ToString();
        }
    }
}

No hay comentarios:

Publicar un comentario