murat335
New member
- Katılım
- 10 Eyl 2005
- Mesajlar
- 874
- Reaction score
- 0
- Puanları
- 0
- Yaş
- 43
adam asmaca oyunu c# da kendi kodlarımdır bir yerde bulamazsınız by murat335
her butonada harf butonlarınına bu clickleri yapacaksınız
PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace adamasmaca
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string cumle = "KÜRŞAT";
public int hak=0;
private void Form1_Load(object sender, EventArgs e)
{
int say=0;
for (int i = 1; i < Controls.Count; i++)
{
if (Controls[i] is Button)
{
(Controls[i] as Button).Enabled = false;
}
if (Controls[i] is Label)
{
(Controls[i] as Label).Visible = false;
(Controls[i] as Label).Text = Convert.ToString(cumle[say]);
say++;
}
}
}
private void button30_Click(object sender, EventArgs e)
{
for (int i = 1; i < Controls.Count; i++)
{
if (Controls[i] is Button)
(Controls[i] as Button).Enabled = true;
}
}
private void hesala(object gelen, EventArgs e)
{
int a = 0;
string kontrol = (gelen as Button).Text;
for (int f = 0; f < cumle.Length; f++)
{
if (cumle[f] == Convert.ToChar(kontrol))
for (int k = 0; k < Controls.Count; k++)
{
if (Controls[k] is Label)
if ((Controls[k] as Label).Text == kontrol)
{
(Controls[k] as Label).Visible = true;
a = 1;
}
}
}
if(a==0)
{
hak++;
if (hak == 3)
{
MessageBox.Show("hakkınız bitmiştir");
Application.Exit();
}
}
}
}
}
PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace adamasmaca
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string cumle = "KÜRŞAT";
public int hak=0;
private void Form1_Load(object sender, EventArgs e)
{
int say=0;
for (int i = 1; i < Controls.Count; i++)
{
if (Controls[i] is Button)
{
(Controls[i] as Button).Enabled = false;
}
if (Controls[i] is Label)
{
(Controls[i] as Label).Visible = false;
(Controls[i] as Label).Text = Convert.ToString(cumle[say]);
say++;
}
}
}
private void button30_Click(object sender, EventArgs e)
{
for (int i = 1; i < Controls.Count; i++)
{
if (Controls[i] is Button)
(Controls[i] as Button).Enabled = true;
}
}
private void hesala(object gelen, EventArgs e)
{
int a = 0;
string kontrol = (gelen as Button).Text;
for (int f = 0; f < cumle.Length; f++)
{
if (cumle[f] == Convert.ToChar(kontrol))
for (int k = 0; k < Controls.Count; k++)
{
if (Controls[k] is Label)
if ((Controls[k] as Label).Text == kontrol)
{
(Controls[k] as Label).Visible = true;
a = 1;
}
}
}
if(a==0)
{
hak++;
if (hak == 3)
{
MessageBox.Show("hakkınız bitmiştir");
Application.Exit();
}
}
}
}
}