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 Tas_Kagit_Makas
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int sayac = 1;
private void timer1_Tick(object sender, EventArgs e)
{
if (sayac == 1)
{
pictureBox1.Image = Properties.Resources.tas;
}
else if (sayac == 2)
{
pictureBox1.Image = Properties.Resources.kagit;
}
if (sayac == 3)
{
pictureBox1.Image = Properties.Resources.makas;
sayac = 0;
}
sayac++;
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
}
Random rnd = new Random();
private void button1_Click(object sender, EventArgs e)
{
int sayi = rnd.Next(1, 4);
if(sayi==3)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.makas;
label1.Text = "KAZANDINIZ!!!";
label1.ForeColor = Color.Green;
label5.Text = (Convert.ToInt32(label5.Text) + 1).ToString();
}
else if (sayi == 1)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.tas;
label1.Text = "BERABERE!!!";
label1.ForeColor = Color.Black;
}
else if (sayi == 2)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.kagit;
label1.Text = "KAYBETTİNİZ!!!";
label1.ForeColor = Color.Red;
label4.Text = (Convert.ToInt32(label4.Text) + 1).ToString();
}
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
int sayi = rnd.Next(1, 4);
if (sayi == 1)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.tas;
label1.Text = "KAZANDINIZ!!!";
label1.ForeColor = Color.Green;
label5.Text = (Convert.ToInt32(label5.Text) + 1).ToString();
}
else if (sayi == 2)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.kagit;
label1.Text = "BERABERE!!!";
label1.ForeColor = Color.Black;
}
else if (sayi == 3)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.makas;
label1.Text = "KAYBETTİNİZ!!!";
label1.ForeColor = Color.Red;
label4.Text = (Convert.ToInt32(label4.Text) + 1).ToString();
}
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = true;
}
private void button3_Click(object sender, EventArgs e)
{
int sayi = rnd.Next(1, 4);
if (sayi == 2)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.kagit;
label1.Text = "KAZANDINIZ!!!";
label1.ForeColor = Color.Green;
label5.Text = (Convert.ToInt32(label5.Text) + 1).ToString();
}
else if (sayi == 1)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.makas;
label1.Text = "BERABERE!!!";
label1.ForeColor = Color.Black;
}
else if (sayi == 3)
{
timer1.Stop();
pictureBox1.Image = Properties.Resources.tas;
label1.Text = "KAYBETTİNİZ!!!";
label1.ForeColor = Color.Red;
label4.Text = (Convert.ToInt32(label4.Text) + 1).ToString();
}
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = false;
label1.Text = "SEÇİNİZ...";
label1.ForeColor = Color.Black;
timer1.Start();
}
}
}
C# ile çok fonksiyonlu hesap makinesi yapımı kodları....
TRCodeRooTeR 8441 1 2019-12-22 05:12:22C# ile yazılmış Bankamatik Otomasyonu program kodları...
TRCodeRooTeR 6990 1 2020-11-16 10:17:29