Formun Tamamı İçin Tıklayınız.
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 WindowsFormsApplication48
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a;
int süre = 0;
private void button13_Click(object sender, EventArgs e)
{
a = 0;
süre = 0;
textBox1.Text = "0";
textBox2.Text = "0";
timer1.Start();
Random rd = new Random();
int sayi1 = rd.Next(1, 20);
int sayi2 = rd.Next(1, 20);
int sayi3 = rd.Next(1, 20);
int sayi4 = rd.Next(1, 20);
int sayi5 = rd.Next(1, 20);
int sayi6 = rd.Next(1, 20);
int sayi7 = rd.Next(1, 20);
int sayi8 = rd.Next(1, 20);
int sayi9 = rd.Next(1, 20);
int sayi10= rd.Next(1, 20);
int sayi11 = rd.Next(1, 20);
int sayi12 = rd.Next(1, 20);
int hedef = rd.Next(50, 200);
button1.Text = sayi1.ToString();
button2.Text = sayi2.ToString();
button3.Text = sayi3.ToString();
button4.Text = sayi4.ToString();
button5.Text = sayi5.ToString();
button6.Text = sayi6.ToString();
button7.Text = sayi7.ToString();
button8.Text = sayi8.ToString();
button9.Text = sayi9.ToString();
button10.Text = sayi10.ToString();
button11.Text = sayi11.ToString();
button12.Text = sayi12.ToString();
textBox1.Text = hedef.ToString();
label3.Visible = true;
button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = true;
button5.Enabled = true;
button6.Enabled = true;
button7.Enabled = true;
button8.Enabled = true;
button9.Enabled = true;
button10.Enabled = true;
button11.Enabled = true;
button12.Enabled = true;
}
public void metod()
{
if (a == Convert.ToInt32(textBox1.Text))
{
MessageBox.Show("Bravoo");
}
}
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button1.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button1.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button1.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button1.Text);
textBox2.Text = a.ToString();
metod();
}
button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button2.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button2.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button2.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button2.Text);
textBox2.Text = a.ToString();
metod();
}
button2.Enabled = false;
}
private void button3_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button3.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button3.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button3.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button3.Text);
textBox2.Text = a.ToString();
metod();
}
button3.Enabled = false;
}
private void button4_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button4.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button4.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button4.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button4.Text);
textBox2.Text = a.ToString();
metod();
}
button4.Enabled = false;
}
private void button5_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button5.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button5.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button5.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button5.Text);
textBox2.Text = a.ToString();
metod();
}
button5.Enabled = false;
}
private void button6_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button6.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button6.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button6.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button6.Text);
textBox2.Text = a.ToString();
metod();
}
button6.Enabled = false;
}
private void button7_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button7.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button7.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button7.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button7.Text);
textBox2.Text = a.ToString();
metod();
}
button7.Enabled = false;
}
private void button8_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button8.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button8.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button8.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button8.Text);
textBox2.Text = a.ToString();
metod();
}
button8.Enabled = false;
}
private void button9_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button9.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button9.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button9.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button9.Text);
textBox2.Text = a.ToString();
metod();
}
button9.Enabled = false;
}
private void button10_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button10.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button10.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button10.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button10.Text);
textBox2.Text = a.ToString();
metod();
}
button10.Enabled = false;
}
private void button11_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button11.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button11.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button11.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button11.Text);
textBox2.Text = a.ToString();
metod();
}
button11.Enabled = false;
}
private void button12_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button12.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
a = a - Convert.ToInt32(button12.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton3.Checked)
{
a = a * Convert.ToInt32(button12.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton4.Checked)
{
a = a / Convert.ToInt32(button12.Text);
textBox2.Text = a.ToString();
metod();
}
button12.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
label3.Text = süre.ToString();
süre += 1;
if (süre == 60)
{
timer1.Stop();
panel1.Enabled = false;
MessageBox.Show("süreniz doldu");
}
}
private void Form1_Load(object sender, EventArgs e)
{
label3.Visible = false;
label3.Text = "0";
}
}
}
Hiç yorum yok:
Yorum Gönder