cell colour for vitual grid

I want to colour the whole row of the current cell to some shellow yellow, current cell bright yellow, however to leave some uneditable cell on this row not coloured. I used some code as below: this.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow; protected override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e) { base.OnPrepareViewStyleInfo(e); if (e.RowIndex > this.Model.Rows.HeaderCount && e.ColIndex > this.Model.Cols.HeaderCount && this.CurrentCell.HasCurrentCellAt(e.RowIndex)) { e.Style.Interior = new BrushInfo(Color.Yellow); } } How to maintain the interior colour of some cell (not editable) in the same row? and how to set the current cell colour?

2 Replies

ST stanleyj Syncfusion Team January 7, 2006 09:10 AM UTC

Hi Hui, By checking HasCurrentCellAt(e.RowIndex, e.ColIndex) and HasReadOnly other requirements are fulfilled. if (e.RowIndex > gridControl1.Model.Rows.HeaderCount && e.ColIndex > gridControl1.Model.Cols.HeaderCount ) if(this.gridControl1.CurrentCell.HasCurrentCellAt(e.RowIndex)) { e.Style.Interior = new BrushInfo(Color.LemonChiffon); } if(this.gridControl1.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex)) { e.Style.Interior = new BrushInfo(Color.Yellow); } if( e.Style.HasReadOnly) { e.Style.Interior = new BrushInfo(Color.White); } Best regards, Stanley


HZ Hui Zhong January 9, 2006 03:25 PM UTC

Thanks. >Hi Hui, > >By checking HasCurrentCellAt(e.RowIndex, e.ColIndex) and HasReadOnly other requirements are fulfilled. > > > if (e.RowIndex > gridControl1.Model.Rows.HeaderCount && e.ColIndex > gridControl1.Model.Cols.HeaderCount ) > if(this.gridControl1.CurrentCell.HasCurrentCellAt(e.RowIndex)) > { > e.Style.Interior = new BrushInfo(Color.LemonChiffon); > } > if(this.gridControl1.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex)) > { > e.Style.Interior = new BrushInfo(Color.Yellow); > } > if( e.Style.HasReadOnly) > { > e.Style.Interior = new BrushInfo(Color.White); > } > > >Best regards, >Stanley

Loader.
Up arrow icon