1. 특정 cell에만 Readonly 설정해주는 코드
column property에서 ReadOnly를 false로 설정해주어야만 코드가 먹는다.
radGridView.Rows[index].Cells[columnName].ReadOnly = true;
2. 특정 cell에만 배경색을 설정해주는 코드
CustomizeFill을 true로 설정해야 적용된다.
radGridView.Rows[index].Cells[columnName].Style.BackColor = Color.YellowGreen;
radGridView.Rows[index].Cells[columnName].Style.CustomizeFill = true;

3. 특정 Column에 배경색 등 style 주는 경우
radGridView_CellFormatting event에서 코드를 작성한다.
private void radGridView_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.Column.Name == "columnName1")
e.CellElement.ForeColor = Color.Red; //폰트색상 변경
else if(e.Column.Name == "columnName2")
e.CellElement.BackColor = Color.YellowGreen; //배경색 변경
e.CellElement.DrawFill = true; //이거 해줘야 배경색 제대로 채워짐
}
728x90
'C#' 카테고리의 다른 글
[C#][Telerik] radGridView Column Auto size (0) | 2024.01.24 |
---|---|
[C#] .resx 파일이란? (0) | 2024.01.04 |