C#/DevExpress

GridControl 행(Row) 높이, Row Cell 스타일, Cell값 변경

바북이 2022. 11. 23. 12:18
반응형

사전 작업 :  GridControl -> Run Designer -> View탭 ->이벤트(액션 볼트)에서 해당 이벤트에 이벤트 함수명을 적어줘야함


- 행(Row) 높이 변경

private void gridControl_CalcRowHeight(object sender, RowHeightEventArgs e)
{
	e.RowHandle //해당 행
	
	Ex)
	e.RowHandle = 15;
}

 

- Row, Cell 스타일 변경

private void gridControl_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
	e.RowHandle //해당 행
	
	Ex)
	e.Appearance.BackColor = Color.FromArgb(255, 255, 255);	
	e.Appearance.BackColor = Color.Black;
}

 

- Cell 값 변경 또는 Cell 내의 Text값 변경

private void gridControl_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
	e.Value //해당 셀 값
	e.DisplayText //해당 셀의 Text
	
	Ex)
	if(e.Value == null)
		e.DisplayText = "Hello";
		e.DisplayText = e.DisplayText + " World"; // 결과 : Hello World
}

 

반응형