Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region Dinamik Nesne Ekleme ve flowLayoutPanel Nesnesinin Görevi

            /* Button btn = new Button();
             * btn.Text = "Buton";
             * this.Controls.Add(btn);
             * TextBox txt = new TextBox();
             * txt.BackColor = Color.Red;
             * txt.ForeColor = Color.White;
             * flowLayoutPanel1.Controls.Add(txt); */
            #endregion

            foreach (Insan kisiler in sinif)
            {
                Button buton = new Button();
                buton.TextAlign = ContentAlignment.TopLeft;
                buton.Width     = 80;
                buton.Height    = 80;
                if (kisiler is Egitmen)
                {
                    Egitmen okunan_kisi = (Egitmen)kisiler;
                    buton.BackColor = Color.Blue;
                    buton.ForeColor = Color.White;
                    buton.Text      = okunan_kisi.ad_soyad + " " + okunan_kisi.personel_no + " " + okunan_kisi.cinsiyet;
                }
                else if (kisiler is Ogrenci)
                {
                    Ogrenci okunan_ogrenci = (Ogrenci)kisiler;
                    buton.BackColor = Color.Green;
                    buton.ForeColor = Color.Black;
                    buton.Text      = okunan_ogrenci.ad_soyad + " " + okunan_ogrenci.ogrenci_no + " " + okunan_ogrenci.cinsiyet;
                }
                flowLayoutPanel1.Controls.Add(buton);
            }
        }