2012-12-10 2 views
0

RowFormatting 이벤트에서 런타임에 Telerik WinForms RadGridView의 행 색상을 설정하는 트릭이 있습니까? 이 이벤트에서는 RowElement.Font를 설정할 수 있지만 RowElement.BackColor는 설정할 수 없습니다. 나는 디버거에서 코드를 밟았으며 라인이 실행 중임을 확신합니다 (이벤트가 제대로 "유선"상태입니다).RowFormatting 이벤트에서 Telerik RadGridView (WinForms)의 RowElement.BackColor를 설정하십시오.

void grid_RowFormatting(object sender, Telerik.WinControls.UI.RowFormattingEventArgs e) 
    { 
     if (e.RowElement.RowInfo.Cells["CODE"].Value.ToString() == "X")) 
       { 
        // the following line is executed but has no apparent effect 
        e.RowElement.BackColor = System.Drawing.Color.Aqua; 
       } 

    } 

답변

2

귀하의 코드가 좋아 보인다, 당신은 단지 DrawFilltrue 이 추가 설정해야합니다

e.RowElement.DrawFill = true;  

전체 예 :

void grid_RowFormatting(object sender, Telerik.WinControls.UI.RowFormattingEventArgs e) 
    { 
     if (e.RowElement.RowInfo.Cells["CODE"].Value.ToString() == "X")) 
       { 
        e.RowElement.DrawFill = true; 
        e.RowElement.BackColor = System.Drawing.Color.Aqua; 
       } 

    } 
+0

을 : 감사를 정보를 원하시면! – Tim