Articles in this section
Category / Section

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 are applied based on the GridVisualStyles.

 

Solution

To change the border line color of the Grid dynamically in WinForms GridControl, use the GridLineColor property. By using this property, you can set all sides (Left, Right, Bottom, and Top) border styles of the 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.

WinForms GridControl with changed GridLineColor


Figure
1: Grid with changed GridLineColor

Samples:

C#: Changing_GridLineColor_CS

VB: Changing_GridLineColor_VB


Conclusion


I hope you enjoyed learning about how to change the GridLineColor dynamically in WinForms GridControl.


You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications.


For current customers, you can check out our 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 other controls.


If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied