Új hozzászólás Aktív témák

  • klambi

    addikt

    válasz bpx #5117 üzenetére

    és annak mi a pontos szintatktikája, vagy hova kell tenni, ha egy gombot leteszek az ellenkező oldalra is és 1 klikkre mind a 2 induljon el? :Y

    ja megvan hóhóhóóóó

    private void button1_Click(object sender, EventArgs e)
    {
    timer1.Start();
    timer2.Start();
    }
    int inc = 7;

    private void timer1_Tick(object sender, EventArgs e)
    {
    button1.Location = new Point(button1.Location.X + inc, button1.Location.Y);
    if (button1.Location.X >= this.ClientRectangle.Width - button1.Width) inc *= -1;
    if (button1.Location.X <= this.ClientRectangle.X) inc *= -1;
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
    button2.Location = new Point(button2.Location.X - inc, button2.Location.Y);
    if (button2.Location.X >= this.ClientRectangle.Width + button2.Width) inc *= +1;
    if (button2.Location.X <= this.ClientRectangle.X) inc *= +1;

    }

    [ Szerkesztve ]

    "Mond szépen angolul: Gyors róka!"

Új hozzászólás Aktív témák