Пример #1
0
        //private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        //{
        //    //if (nudOdaSayisi.Value >= sayac)
        //    //{
        //    //    c++;
        //    //    sayac++;
        //    //    Button button = new Button();
        //    //    button.Left = 50*c;
        //    //    if (c%6==0)
        //    //    {
        //    //        y += 50;
        //    //        button.Left = 50;
        //    //        c = 1;
        //    //    }
        //    //    button.Top = 10 + y;
        //    //    button.Size = new Size(50, 50);
        //    //    button.Name = "button1_" + sayac.ToString();

        //    //    grpOdalar.Controls.Add(button);
        //    //}
        //    //else
        //    //{
        //    //    grpOdalar.Controls.RemoveByKey("button1_" + sayac.ToString());
        //    //    sayac--;
        //    //}
        //}

        private void btnOdaYarat_Click(object sender, EventArgs e)
        {
            sayac = OdaController.OdaSayisiniGetir();

            for (int i = 0; i < nudOdaSayisi.Value; i++)
            {
                //if ((nudOdaSayisi.Value >= sayac))
                //{
                c++;
                sayac++;
                button      = new Button();
                button.Left = 50 * c;
                if (c % 5 == 0)
                {
                    y          += 50;
                    button.Left = 50;
                    c           = 1;
                }
                button.Top       = 25 + y;
                button.Size      = new Size(50, 50);
                button.Name      = "button_" + sayac.ToString();
                button.Text      = $"Oda {sayac}";
                button.FlatStyle = FlatStyle.Flat;
                button.ForeColor = Color.FromArgb(196, 144, 61);
                button.BackColor = Color.Transparent;
                grpOdalar.Controls.Add(button);
                if ((OdaController.OdaNumarasi(sayac) != button.Text) && OdaController.OdaIDGetir() != sayac)
                {
                    OdaOda.OdaNumarasi = button.Text;
                    OdaOda.KisiSayisi  = 2;
                    OdaController.OdaEkle(OdaOda);
                }
                else
                {
                    continue;
                }
                //}
            }
            y = 0;
            c = 0;
            //sayac = 0;
        }
Пример #2
0
        //private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        //{
        //    //if (nudOdaSayisi.Value >= sayac)
        //    //{
        //    //    c++;
        //    //    sayac++;
        //    //    Button button = new Button();
        //    //    button.Left = 50*c;
        //    //    if (c%6==0)
        //    //    {
        //    //        y += 50;
        //    //        button.Left = 50;
        //    //        c = 1;
        //    //    }
        //    //    button.Top = 10 + y;
        //    //    button.Size = new Size(50, 50);
        //    //    button.Name = "button1_" + sayac.ToString();

        //    //    grpOdalar.Controls.Add(button);
        //    //}
        //    //else
        //    //{
        //    //    grpOdalar.Controls.RemoveByKey("button1_" + sayac.ToString());
        //    //    sayac--;
        //    //}
        //}

        private void btnOdaYarat_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < nudOdaSayisi.Value; i++)
            {
                if ((nudOdaSayisi.Value >= sayac))
                {
                    c++;
                    sayac++;
                    button      = new Button();
                    button.Left = 50 * c;
                    if (c % 5 == 0)
                    {
                        y          += 50;
                        button.Left = 50;
                        c           = 1;
                    }
                    button.Top  = 25 + y;
                    button.Size = new Size(50, 50);
                    button.Name = "button_" + sayac.ToString();
                    button.Text = $"Oda {sayac}";
                    grpOdalar.Controls.Add(button);
                    if ((OdaController.OdaNumarasi(sayac) != button.Text) && OdaController.OdaIDGetir() != sayac)
                    {
                        Oda.OdaNumarasi = button.Text;
                        OdaController.OdaEkle(Oda);
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            y     = 0;
            c     = 0;
            sayac = 0;
        }