2009-09-22 2 views
1

여기서 상황을 정리해 보겠습니다. WIN 양식에 devexpress의 gridview 컨트롤이 있습니다. 그리드의 짝수 행의 모양을 설정하자. 배경색 = color.whiteSmoke (사용자가 행을 쉽게 구별하는 것을 돕기 위해). 디자인 타임에이 작업을 수행합니다. 이제 이벤트에서 내 조건과 일치하는 행을 프로그래밍 방식으로 빨간색으로 표시해 봅시다 : gridView_RowStyle.짝수 행의 모양이 일부 행의 사용자 정의 모양으로 겹쳐 쓰여졌습니까?

문제는 짝수 행보다 내 조건과 일치하는 것이 아직도 whitesmoke에 채색되어 있습니까?!?!?

짝수 행의 모양이 사용자 정의 모양으로 덮어 쓰여지는 것을 의미합니까?

나는 그것을 얻지 못하고있다. 내 조건에 맞는 행이 빨간색으로 표시되도록하려면 어떻게해야합니까?

답변

1

음, 분명히 그렇습니다. 짝수 행의 모양이 RowStyle 이벤트에서 채색 된 행의 모양으로 덮어 씁니다.

솔루션, 프로그램 다음 예에서와 같이 그리드를 결합하면서 피할 덮어 쓴이의 DevExpress.XtraGrid.StyleFormatCondition 객체의 사용이되도록 : 이것은 내 문제를 해결했다

this.gridControl.DataSource = dataTable; 

DevExpress.XtraGrid.StyleFormatCondition styleFormatCondition1 = 
       new DevExpress.XtraGrid.StyleFormatCondition(); 

styleFormatCondition1.Appearance.BackColor = System.Drawing.Color.LightCoral; 
styleFormatCondition1.Appearance.BackColor2 = System.Drawing.Color.SeaShell; 
styleFormatCondition1.Appearance.Options.UseBackColor = true; 
styleFormatCondition1.ApplyToRow = true; 
styleFormatCondition1.Condition = DevExpress.XtraGrid.FormatConditionEnum.Equal; 
styleFormatCondition1.Column = this.gridView.Columns["MY_COLUMN"]; 
styleFormatCondition1.Value1 = "0"; 

this.gridView.FormatConditions.AddRange(
       new DevExpress.XtraGrid.StyleFormatCondition[] {styleFormatCondition1}); 

. 누군가를 돕기를 바랍니다.