Kodarı:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace atyarisi
{
public partial class Form1 : Form
{
Random a = new Random();
int x1, x2, x3;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Text = "At yarışı";
int r1 = a.Next(5, 50);
int r2 = a.Next(5, 50);
int r3 = a.Next(5, 50);
timer1.Interval = r1;
timer2.Interval = r2;
timer3.Interval = r3;
timer1.Start();
timer2.Start();
timer3.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
x1 = x1 + 2;
label1.Location = new Point(x1, 9);
if (x1 == 500)
{
timer1.Stop();
listBox1.Items.Add("bordo");
}
}
private void timer2_Tick(object sender, EventArgs e)
{
x2 = x2 + 2;
label2.Location = new Point(x2, 43);
if (x2 == 500)
{
timer2.Stop();
listBox1.Items.Add("sarı");
}
}
private void timer3_Tick(object sender, EventArgs e)
{
x3 = x3 + 2;
label3.Location = new Point(x3, 78);
if (x3 == 500)
{
timer3.Stop();
listBox1.Items.Add("yeşil");
}
}
}
}
Hazırlayan: Adil AYGÜN
Hiç yorum yok:
Yorum Gönder