Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
2378 | Jan 14,2003 12:37 PM UTC | Jan 16,2003 10:26 AM UTC | WinForms | 6 |
![]() |
Tags: GridControl |
//hook the event
GridControl grid = gridListControl1.Grid;
grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
//the event handler private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if( e.RowIndex > 0) { if(e.RowIndex % 2 == 1) { e.Style.BackColor = Color.Blue; } else { e.Style.BackColor = Color.AliceBlue; } } }
> //hook the event
> GridControl grid = gridListControl1.Grid;
> grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
>
>
>
> > //the event handler > private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) > { > if( e.RowIndex > 0) > { > if(e.RowIndex % 2 == 1) > { > e.Style.BackColor = Color.Blue; > } > else > { > e.Style.BackColor = Color.AliceBlue; > } > } > } >Clay do you have the code in VB.net? I am not familiar with C#. Thanks, Bill
' in form load
'hook the event
Dim grid As GridControl = gridListControl1.Grid
AddHandler grid.PrepareViewStyleInfo, AddressOf grid_PrepareViewStyleInfo
' the handler 'the event handler Private Sub grid_PrepareViewStyleInfo(sender As Object, e As GridPrepareViewStyleInfoEventArgs) If e.RowIndex > 0 Then If e.RowIndex Mod 2 = 1 Then e.Style.BackColor = Color.Blue Else e.Style.BackColor = Color.AliceBlue End If End If End Sub 'grid_PrepareViewStyleInfo
Imports Syncfusion.Windows.Forms.Grid
as the first line in your file (outside the class definition).
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.