CafeProject.GarsonEkrani.renklendir C# (CSharp) Метод

renklendir() публичный Метод

public renklendir ( ) : void
Результат void
        public void renklendir()
        {
            try
            {

                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    Application.DoEvents();

                    DataGridViewCellStyle rowColor = new DataGridViewCellStyle();

                    //durum sutunundaki degere göre satir rengi degistiriyoruz.
                    if (Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value) == 0)//Masa Dolu
                    {

                        // Masa dolu olanlar OrangeRed rengini veriyoruz.
                        rowColor.BackColor = Color.Pink;
                        //yazi rengi beyaz oluyor.
                        rowColor.ForeColor = Color.White;
                    }
                    else if (Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value) == 1)//Ödeme Yapýlmýs masa avaliable
                    {
                        rowColor.BackColor = Color.Blue;
                        rowColor.ForeColor = Color.White;
                    }
                    else if (Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value) == 2)//Aþcýya sipariþ verildi
                    {
                        rowColor.BackColor = Color.OrangeRed;
                        rowColor.ForeColor = Color.White;
                    }

                    //satir rengini degistiriyoruz.

                    dataGridView1.Rows[i].DefaultCellStyle = rowColor;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("Hata:" + ex);
            }
        }