Geri git   Programlama ve Elektronik > Programlama Yazılım > C - C++ - C# - Visual C++ - Visual C# > Örnek Kodlar
Kayıt ol Yardım Community Bugünki Mesajlar Arama

Cevapla
 
Seçenekler Stil
Alt 17. May 2008, 03:39 AM   #1 (permalink)
Amatör
 
McDroPp - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Mar 2008
Nerden: C# SQl Server 2008 İnformation Technology's Server Secretary And Aspx To lınk Tecnolojıes,Mybb
Mesajlar: 51
Standart Adam Asmaca

Adam Asmaca
--------------------------------------------------------------------------------
Visual C#.net geliştirilmiş adam asmaca oyunu..

//Adam asmaca için resim kullanmak istiyorsanız.ResimPicturebox 'a resim ekleyiniz.

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

namespace adam_asmaca
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button30_Click(object sender EventArgs e)
{
foreach (Control i in this.Controls) //form üzerindeki bütün kontrolleri tarar....
{
if (i.GetType().Name == "Button") //form üzerindeki buton kontrollerini ayıklama işlemi yapar...
((Button)i).Enabled = true; //bulunan tüm butonların enabled özelliklerini false yapar....
}
button30.Enabled = false;
Random r = new Random();
int sayi = r.Next(39);
comboBox1.SelectedIndex = sayi;
textBox1.Text = comboBox1.Text;
}
private void YAZ(object sender EventArgs e)
{
label9.Text = (sender as ButtonBase ).Text ;
}
private void label1_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(0 1) true) == 0)
{
label1.Text = label9.Text.ToString();
label1.Enabled = false;
won();
}
else
AS();
}
private void label2_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(1 1) true) == 0)
{
label2.Text = label9.Text.ToString();
label2.Enabled = false;
won();
}
else
AS();
}
private void label3_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(2 1) true) == 0)
{
label3.Text = label9.Text.ToString();
label3.Enabled = false;
won();
}
else
AS();
}
private void label4_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(3 1) true) == 0)
{
label4.Text = label9.Text.ToString();
label4.Enabled = false;
won();
}
else
AS();
}
private void label5_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(4 1) true) == 0)
{
label5.Text = label9.Text.ToString();
label5.Enabled = false;
won();
}
else
AS();
}
private void label6_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(5 1) true) == 0)
{
label6.Text = label9.Text.ToString();
label6.Enabled = false;
won();
}
else
AS();
}
private void label7_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(6 1) true) == 0)
{
label7.Text = label9.Text.ToString();
label7.Enabled = false;
won();
}
else
AS();
}
private void label8_Click(object sender EventArgs e)
{
if (string.Compare(label9.Text textBox1.Text.Substring(7 1) true) == 0)
{
label8.Text = label9.Text.ToString();
label8.Enabled = false;
won();
}
else
AS();
}
void AS()
{
if (pictureBox1 .Visible ==false)
{pictureBox1.Visible = true;}
else if(pictureBox2 .Visible ==false )
{pictureBox2 .Visible =true ;}
else if (pictureBox3.Visible == false)
{ pictureBox3.Visible = true; }
else if (pictureBox4.Visible == false)
{ pictureBox4.Visible = true; }
else if (pictureBox5.Visible == false)
{ pictureBox5.Visible = true; }
else if (pictureBox6.Visible == false)
{ pictureBox6.Visible = true; }
else if (pictureBox7.Visible == false)
{ pictureBox7.Visible = true; }
else if (pictureBox8.Visible == false)
{ pictureBox8.Visible = true;}
else if (pictureBox9.Visible == false)
{ pictureBox9.Visible = true; }
else if (pictureBox10.Visible == false)
{ pictureBox10.Visible = true;
kayıp();
}
}
void kayıp()
{
if(pictureBox10 .Visible ==true)
MessageBox.Show("TEBRİKLER OYUNU KAYBETTİNİZ.......BULMANIZ GEREKEN KELİME " + textBox1.Text + " 'olması gerekirdi...");
foreach (Control h in this.Controls) //form üzerindeki bütün kontrolleri tarar....
{
if (h.GetType().Name == "Label") //form üzerindeki buton kontrollerini ayıklama işlemi yapar...
((Label)h).Enabled = true; //bulunan tüm butonların enabled özelliklerini false yapar....
}
foreach (Control k in this.Controls) //form üzerindeki bütün kontrolleri tarar....
{
if (k.GetType().Name == "PictureBox") //form üzerindeki buton kontrollerini ayıklama işlemi yapar...
((PictureBox)k).Visible = false; //bulunan tüm butonların enabled özelliklerini false yapar....
}
foreach (Control i in this.Controls) //form üzerindeki bütün kontrolleri tarar....
{
if (i.GetType().Name == "Button") //form üzerindeki buton kontrollerini ayıklama işlemi yapar...
((Button)i).Enabled = false; //bulunan tüm butonların enabled özelliklerini false yapar....
}
foreach (Control m in this.Controls) //form üzerindeki bütün kontrolleri tarar....
{
if (m.GetType().Name == "Label") //form üzerindeki buton kontrollerini ayıklama işlemi yapar...
((Label)m).Text = " "; //bulunan tüm butonların enabled özelliklerini false yapar....
}
button30.Enabled = true;
}
void won()
{
if (label1.Enabled == false & label2.Enabled == false & label3.Enabled == false & label4.Enabled == false
& label5.Enabled == false & label6.Enabled == false & label7.Enabled == false & label8.Enabled == false)
{
MessageBox.Show("TEBRİKLER KAZANDINIZ....");
kayıp();
}
}
__________________
بِسْــــــــــــــــــــــمِ اﷲِارَّحْمَنِ ارَّحِيم

-------------------------------------------------

Bu Soysuzlar Bu Vatansızlar Sarsada Yurdumu Ben Yaratan'dan Alırım Asil Kanı ve Gücü.
-------------------------------------------------
McDroPp isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Cevapla


Yetkileriniz
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-KodlarıKapalı
Trackbacks are Kapalı
Pingbacks are Kapalı
Refbacks are Kapalı