본문 바로가기
C#

C# DataGridView에 색깔 설정하는 방법

by orange+ 2023. 5. 16.

DataGridView는 다음과 같은 형태로 색깔을 설정할 수 있습니다.

참고하세요.   

 

public void RowsColor() {     

    for(int i = 0; i < dataGridView1.Rows.Count; i++)     

    {         

        int val = Int32.Parse(dataGridView1.Rows[i].Cells[2].Value.ToString());         

        if (val < 5)         

        {             

            dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;            

        }         

        else if (var >= 5 && val < 10)         

       {                

            dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Orange;         

        }        

    }

}   

 

늘 그렇듯, 모두 모두 화이팅 입니다 !!!

 

 

 

 

 

그런데 혹시 가슴이 답답해 명상이나 힐링이 필요하시다면?

아래로 한번 들러 주세요~ ^^

 

https://youtu.be/oRHsThgQdzk?feature=shared

 

'C#' 카테고리의 다른 글

C# WPF Popup Window 띄우기  (0) 2023.05.16
C# DataGridView 꾸미기  (0) 2023.05.16
C#에서 DataGridView 폰트 지정 방법  (0) 2023.05.16
C# MDI 창에서 Child Form 을 띄우는 방법  (0) 2023.05.16
C# Winform 어플리케이션 종료  (1) 2023.05.16

댓글