C# Sudoku Yapımı

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    saybirs
    saybirs's avatar
    Kayıt Tarihi: 24/Temmuz/2009
    Erkek

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace sudoku
    {
        public partial class Form1 : Form
        {
            int a1, a2, a3, b1, b2, b3, c1, c2, c3;
            public Form1()
            {
                InitializeComponent();
            }
    
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
              
                if (cb1.SelectedIndex == 0)
                a1=0;
                else
            a1= Convert.ToInt32(cb1.Text);
            lbl_sag1.Text = Convert.ToString(a1+b1+c1);
            lbl_alt1.Text = Convert.ToString(a1 + a2 + a3);
                if(lbl_alt1.Text=="15")
                    lbl_alt1.BackColor=Color.Blue;
                else
                    lbl_alt1.BackColor=Color.Maroon;
                if(lbl_sag1.Text=="15")
                    lbl_sag1.BackColor=Color.Blue;
                else
                    lbl_sag1.BackColor=Color.Maroon;
    
                if(cb1.Text==cb4.Text)
                    cb4.Text="";
                if (cb1.Text == cb7.Text)
                    cb7.Text = "";
                if (cb1.Text == cb2.Text)
                    cb2.Text = "";
                if (cb1.Text == cb5.Text)
                    cb5.Text = "";
                if (cb1.Text == cb8.Text)
                    cb8.Text = "";
                if (cb1.Text == cb3.Text)
                    cb3.Text = "";
                if (cb1.Text == cb6.Text)
                    cb6.Text = "";
                if (cb1.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (cb2.SelectedIndex == 0)
                    b1 = 0;
                else
                    b1 = Convert.ToInt32(cb2.Text);
                lbl_sag1.Text = Convert.ToString(a1 + b1 + c1);
                lbl_alt2.Text = Convert.ToString(b1 + b2 + b3);
                if(lbl_alt2.Text=="15")
                    lbl_alt2.BackColor=Color.Blue;
                else
                    lbl_alt2.BackColor=Color.Maroon;
                if(lbl_sag1.Text=="15")
                    lbl_sag1.BackColor=Color.Blue;
                else
                    lbl_sag1.BackColor=Color.Maroon;
    
                if(cb2.Text==cb1.Text)
                    cb1.Text="";
                if (cb2.Text == cb4.Text)
                    cb4.Text = "";
                if (cb2.Text == cb7.Text)
                    cb7.Text = "";
                if (cb2.Text == cb5.Text)
                    cb5.Text = "";
                if (cb2.Text == cb8.Text)
                    cb8.Text = "";
                if (cb2.Text == cb3.Text)
                    cb3.Text = "";
                if (cb2.Text == cb6.Text)
                    cb6.Text = "";
                if (cb2.Text == cb9.Text)
                    cb9.Text = "";
    
            }
    
            private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
            {
    
                if (cb3.SelectedIndex == 0)
                    c1 = 0;
                else
                    c1 = Convert.ToInt32(cb3.Text);
                lbl_sag1.Text = Convert.ToString(a1 + b1 + c1);
                lbl_alt3.Text = Convert.ToString(c1 + c2 + c3);
                if(lbl_alt3.Text=="15")
                    lbl_alt3.BackColor=Color.Blue;
                else
                    lbl_alt3.BackColor=Color.Maroon;
                if(lbl_sag1.Text=="15")
                    lbl_sag1.BackColor=Color.Blue;
                else
                    lbl_sag1.BackColor=Color.Maroon;
    
                if(cb3.Text==cb4.Text)
                    cb4.Text="";
                if (cb3.Text == cb7.Text)
                    cb7.Text = "";
                if (cb3.Text == cb2.Text)
                    cb2.Text = "";
                if (cb3.Text == cb5.Text)
                    cb5.Text = "";
                if (cb3.Text == cb8.Text)
                    cb8.Text = "";
                if (cb3.Text == cb1.Text)
                    cb3.Text = "";
                if (cb3.Text == cb6.Text)
                    cb6.Text = "";
                if (cb3.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
            {
    
                if (cb4.SelectedIndex == 0)
                    a2 = 0;
                else
                    a2 = Convert.ToInt32(cb4.Text);
                lbl_sag2.Text = Convert.ToString(a2 + b2 + c2);
                lbl_alt1.Text = Convert.ToString(a1 + a2 + a3);
                if (lbl_alt1.Text == "15")
                    lbl_alt1.BackColor = Color.Blue;
                else
                    lbl_alt1.BackColor = Color.Maroon;
                if (lbl_sag2.Text == "15")
                    lbl_sag2.BackColor = Color.Blue;
                else
                    lbl_sag1.BackColor = Color.Maroon;
    
                if (cb4.Text == cb1.Text)
                    cb1.Text = "";
                if (cb4.Text == cb7.Text)
                    cb7.Text = "";
                if (cb4.Text == cb2.Text)
                    cb2.Text = "";
                if (cb4.Text == cb5.Text)
                    cb5.Text = "";
                if (cb4.Text == cb8.Text)
                    cb8.Text = "";
                if (cb4.Text == cb3.Text)
                    cb3.Text = "";
                if (cb4.Text == cb6.Text)
                    cb6.Text = "";
                if (cb4.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
            {
                
                if (cb7.SelectedIndex == 0)
                    a3 = 0;
                else
                    a3 = Convert.ToInt32(cb7.Text);
                lbl_sag3.Text = Convert.ToString(a3 + b3 + c3);
                lbl_alt1.Text = Convert.ToString(a1 + a2 + a3);
                if (lbl_alt1.Text == "15")
                    lbl_alt1.BackColor = Color.Blue;
                else
                    lbl_alt1.BackColor = Color.Maroon;
                if (lbl_sag3.Text == "15")
                    lbl_sag3.BackColor = Color.Blue;
                else
                    lbl_sag3.BackColor = Color.Maroon;
    
                if (cb7.Text == cb4.Text)
                    cb4.Text = "";
                if (cb7.Text == cb1.Text)
                    cb7.Text = "";
                if (cb7.Text == cb2.Text)
                    cb2.Text = "";
                if (cb7.Text == cb5.Text)
                    cb5.Text = "";
                if (cb7.Text == cb8.Text)
                    cb8.Text = "";
                if (cb7.Text == cb3.Text)
                    cb3.Text = "";
                if (cb7.Text == cb6.Text)
                    cb6.Text = "";
                if (cb7.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (cb5.SelectedIndex == 0)
                    b2 = 0;
                else
                    b2 = Convert.ToInt32(cb5.Text);
                lbl_sag2.Text = Convert.ToString(a2 + b2 + c2);
                lbl_alt2.Text = Convert.ToString(b1 + b2 + b3);
                if (lbl_alt2.Text == "15")
                    lbl_alt2.BackColor = Color.Blue;
                else
                    lbl_alt2.BackColor = Color.Maroon;
                if (lbl_sag2.Text == "15")
                    lbl_sag2.BackColor = Color.Blue;
                else
                    lbl_sag2.BackColor = Color.Maroon;
    
                if (cb5.Text == cb1.Text)
                    cb1.Text = "";
                if (cb5.Text == cb4.Text)
                    cb4.Text = "";
                if (cb5.Text == cb7.Text)
                    cb7.Text = "";
                if (cb5.Text == cb2.Text)
                    cb2.Text = "";
                if (cb5.Text == cb8.Text)
                    cb8.Text = "";
                if (cb5.Text == cb3.Text)
                    cb3.Text = "";
                if (cb5.Text == cb6.Text)
                    cb6.Text = "";
                if (cb5.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (cb8.SelectedIndex == 0)
                    b3 = 0;
                else
                    b3 = Convert.ToInt32(cb8.Text);
                lbl_sag3.Text = Convert.ToString(a3 + b3 + c3);
                lbl_alt2.Text = Convert.ToString(b1 + b2 + b3);
                if (lbl_alt2.Text == "15")
                    lbl_alt2.BackColor = Color.Blue;
                else
                    lbl_alt2.BackColor = Color.Maroon;
                if (lbl_sag3.Text == "15")
                    lbl_sag3.BackColor = Color.Blue;
                else
                    lbl_sag3.BackColor = Color.Maroon;
    
                if (cb8.Text == cb1.Text)
                    cb1.Text = "";
                if (cb8.Text == cb4.Text)
                    cb4.Text = "";
                if (cb8.Text == cb7.Text)
                    cb7.Text = "";
                if (cb8.Text == cb2.Text)
                    cb2.Text = "";
                if (cb8.Text == cb5.Text)
                    cb5.Text = "";
                if (cb8.Text == cb3.Text)
                    cb3.Text = "";
                if (cb8.Text == cb6.Text)
                    cb6.Text = "";
                if (cb8.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (cb6.SelectedIndex == 0)
                    c2 = 0;
                else
                    c2 = Convert.ToInt32(cb6.Text);
                lbl_sag2.Text = Convert.ToString(a2 + b2 + c2);
                lbl_alt3.Text = Convert.ToString(c1 + c2 + c3);
                if (lbl_alt3.Text == "15")
                    lbl_alt3.BackColor = Color.Blue;
                else
                    lbl_alt3.BackColor = Color.Maroon;
                if (lbl_sag2.Text == "15")
                    lbl_sag2.BackColor = Color.Blue;
                else
                    lbl_sag2.BackColor = Color.Maroon;
    
                if (cb6.Text == cb4.Text)
                    cb4.Text = "";
                if (cb6.Text == cb7.Text)
                    cb7.Text = "";
                if (cb6.Text == cb2.Text)
                    cb2.Text = "";
                if (cb6.Text == cb5.Text)
                    cb5.Text = "";
                if (cb6.Text == cb8.Text)
                    cb8.Text = "";
                if (cb6.Text == cb1.Text)
                    cb3.Text = "";
                if (cb6.Text == cb3.Text)
                    cb6.Text = "";
                if (cb6.Text == cb9.Text)
                    cb9.Text = "";
            }
    
            private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
            {
                
                if (cb9.SelectedIndex == 0)
                    c3 = 0;
                else
                    c3 = Convert.ToInt32(cb9.Text);
                lbl_sag3.Text = Convert.ToString(a3 + b3 + c3);
                lbl_alt3.Text = Convert.ToString(c1 + c2 + c3);
                if (lbl_alt3.Text == "15")
                    lbl_alt3.BackColor = Color.Blue;
                else
                    lbl_alt3.BackColor = Color.Maroon;
                if (lbl_sag3.Text == "15")
                    lbl_sag3.BackColor = Color.Blue;
                else
                    lbl_sag3.BackColor = Color.Maroon;
    
                if (cb9.Text == cb4.Text)
                    cb4.Text = "";
                if (cb9.Text == cb7.Text)
                    cb7.Text = "";
                if (cb9.Text == cb2.Text)
                    cb2.Text = "";
                if (cb9.Text == cb5.Text)
                    cb5.Text = "";
                if (cb9.Text == cb8.Text)
                    cb8.Text = "";
                if (cb9.Text == cb1.Text)
                    cb3.Text = "";
                if (cb9.Text == cb6.Text)
                    cb6.Text = "";
                if (cb9.Text == cb3.Text)
                    cb9.Text = "";
            }
    
            private void lbl_alt3_Click(object sender, EventArgs e)
            {
    
            }
        }
    }


    Programın Kodları ve Tasarımı sadece BANA AİTTİR.Hiçbir şekilde başka biryerden alıntı yapılmamıştır.
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    saybirs
    saybirs's avatar
    Kayıt Tarihi: 24/Temmuz/2009
    Erkek

    anlamadığınız yerler olursa cevaplarım.

  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    Holyzone
    Holyzone's avatar
    Üstün Hizmet Madalyası
    Kayıt Tarihi: 13/Ekim/2008
    Erkek

    Güzel proje hocam eline sağlık :=)

Toplam Hit: 2866 Toplam Mesaj: 3