top of page
Ara

Form Aplication At Yarışı Yapımı

  • ByAdmin
  • 21 Ara 2015
  • 1 dakikada okunur

Form Application At Yarışı Yapımı Bilgisayar Random Sayı Belirleyerek ​ yani kafasından Sayı Üreterek Atların Hareket Etmesini Saglıyor..

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

namespace WFA_AtYarışı { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Random rnd = new Random(); private void btnBaslat_Click(object sender, EventArgs e) { timer1.Start(); btnBaslat.Enabled = false; }

private void timer1_Tick(object sender, EventArgs e) { pcBoxAt1.Left += rnd.Next(0, 30); pcBoxAt2.Left += rnd.Next(0, 15); pcAt3.Left += rnd.Next(0, 15);

if (pcBoxAt1.Right>=lblFinish.Left) { Yarıs("1"); } else if(pcBoxAt2.Right>=lblFinish.Left) { Yarıs("2"); } else if(pcAt3.Right>=lblFinish.Left) { Yarıs("3"); } }

private void Yarıs( string yarisci) { timer1.Stop(); DialogResult sonuc = MessageBox.Show(yarisci +".at kazandı Tekrar oynamak istermisiniz?", "Oyun Bitti", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (sonuc == DialogResult.Yes) { btnBaslat.Enabled = true;

pcAt3.Left = pcBoxAt2.Left = pcBoxAt1.Left = 0;

} else { this.Close(); } }

private void Form1_Load(object sender, EventArgs e) {

} } }

Comments


Tanıtılan Yazılar
Son Paylaşımlar
Arşiv
Etiketlere Göre Ara
Bizi Takip Edin
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page