Refleks Test Oyunu — C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;//www.gorselprogramlama.com using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Refleks_Test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } int kalanSure = 0; int skor = 0; Random r = new Random(); Button btn = new Button(); [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern int GetTickCount(); private void button1_Click(object sender, EventArgs e) { kalanSure = 45; skor = 0;//www.gorselprogramlama.com timer1.Enabled = true; button1.Visible = false; } void yeniButton() { btn.Dispose(); btn = new Button(); btn.Top = r.Next(0, this.Height - 80); btn.Left = r.Next(0, this.Width - 80); btn.Size = new Size(35,35); btn.BackColor = Color.Green;//www.gorselprogramlama.com btn.Click += new EventHandler(btn_Click); this.Controls.Add(btn); } void btn_Click(object sender, EventArgs e) { skor+=10; btn.Dispose(); } private void timer1_Tick(object sender, EventArgs e) { if (kalanSure != 0) { yeniButton();//www.gorselprogramlama.com kalanSure--; } else // == 0 { btn.Dispose(); timer1.Enabled = false; MessageBox.Show("Süreniz doldu toplam skorunuz : " + skor.ToString()); button1.Visible = true; lblSkor.Text = "Skor : 0"; } lblSure.Text = "Kalan Süre : " + kalanSure.ToString(); lblSkor.Text = "Skor : " + skor.ToString(); } }//www.gorselprogramlama.com }