본문 바로가기
PC&웹/VS프로그래밍

C# DevExpress GridView FooterCell 숫자 꾸미기

by Simulz 2022. 9. 15.
반응형

View 바닥의 파랑, 빨강, 굵은 숫자

Grid의 Footer Cell은 디자인 타임에 Appearance 설정이 되지 않는다.

런타임에 CustomDrawFooterCell 이벤트를 사용하면 원하는 대로 꾸밀 수 있다.

FooterCell이 그려지기 전에 이벤트가 발생한다.

private void gridView1_CustomDrawFooterCell(object sender, FooterCellCustomDrawEventArgs e)
{
    if (string.Compare(e.Column.FieldName, "수입") == 0)
    {
        e.Appearance.ForeColor = Color.Blue;
        e.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold);
        e.Painter.DrawObject(e.Info);
        e.Handled = true;
        return;
    }
    else if (string.Compare(e.Column.FieldName, "지출") == 0)
    {
        e.Appearance.ForeColor = Color.Red;
        e.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold);
        e.Painter.DrawObject(e.Info);
        e.Handled = true;
        return;
    }
}

꾸몄다면 e.Handled을 True로 설정해야 함. False로 하면 기본 설정이 적용 됨.

 

참조

GridView.CustomDrawFooterCell Event | WinForms Controls | DevExpress Documentation

 

GridView.CustomDrawFooterCell Event | WinForms Controls | DevExpress Documentation

GridView.CustomDrawFooterCell Event Namespace: DevExpress.XtraGrid.Views.Grid Assembly: DevExpress.XtraGrid.v22.1.dll Declaration C# VB.NET Event Data The CustomDrawFooterCell event's data class is FooterCellCustomDrawEventArgs. The following properties pr

docs.devexpress.com

 

반응형

태그

,

댓글0