이제 DataGridView 헤더 배경색이 회색으로 표시됩니다. differenct 색상으로 변경하고 싶습니다.DataGridView 헤더 색상을 변경하는 방법
배경색을 ColumnHeaderDefaultCellStyle
으로 변경했지만 아무 것도 변경되지 않았습니다.
수행 방법.
는이제 DataGridView 헤더 배경색이 회색으로 표시됩니다. differenct 색상으로 변경하고 싶습니다.DataGridView 헤더 색상을 변경하는 방법
배경색을 ColumnHeaderDefaultCellStyle
으로 변경했지만 아무 것도 변경되지 않았습니다.
수행 방법.
는, 다음 코드
' Set the selection background color for all the cells.
dataGridView1.DefaultCellStyle.SelectionBackColor = Color.White
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Black
' Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default
' value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
dataGridView1.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty
' Set the background color for all rows and for alternating rows.
' The value for alternating rows overrides the value for all rows.
dataGridView1.RowsDefaultCellStyle.BackColor = Color.LightGray
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.DarkGray
' Set the row and column header styles.
dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Black
dataGridView1.RowHeadersDefaultCellStyle.BackColor = Color.Black
편집을 참조하십시오의 DataGridViewCellStyle를 사용
를 헤더 색상 것이다 변경하지만 헤더의 열위한 구분자 섹션이 나타나지 않습니다. 그래서를 heres의 OnPaint 이벤트 핸들러의 오버라이드 이벤트는 다음 원하는 색상으로 ColumnHeaderDefaultCellStyle
배경 색상을 변경, 재산 EnableHeadersVisualStyles
False
로 설정 this
를 보라. 디자이너 자체의 변경 사항을 볼 수 있습니다.
dublicate? http://stackoverflow.com/questions/3921497/setting-gridview-header-color –
@Soner, Windows 기반 응용 프로그램을 사용 중입니다. – Gopal
@ Gopal, 그러면 gridview가 아닌 dataGridView를 제공해야합니다. –