How to change the GridLineColor dynamically in WinForms GridControl?
Change the border style
By default, the border style is dotted lines and the border color is gray. The border color and style is applied based on the GridVisualStyles.
To change the border line color of the Grid dynamically in , use the GridLineColor property. By using this property, you can set all sides (Left, Right, Bottom, and Top) border styles of Grid. This is applied only when you set the border style using DefaultGridBorderStyle to ‘Solid’. Refer to the following code example.
//Setting border line color this.grid.GridLineColor = Color.Red; //Setting border style to solid this.grid.DefaultGridBorderStyle = GridBorderStyle.Solid;
'Setting border line color Me.grid.GridLineColor = Color.Red 'Setting border style to solid Me.grid.DefaultGridBorderStyle = GridBorderStyle.Solid
The following screenshot illustrates the output.
Figure 1: Grid with changed GridLineColor
I hope you enjoyed learning about how to change the GridLineColor dynamically in WinForms GridControl.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridControl and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!