Articles in this section
Category / Section

What is the purpose of the GridRangeInfo class in WinForms GridControl?

1 min read

Purpose of GridRangeInfo class

In WinForms Gridcontrol, GridRangeInfo class allows specification of a range of grid cells. This GridRangeInfo class is used in many grid methods that do their work on a range of cells. It has ranges like a single cell, a rectangular collection of cells, a row or a range of rows, a column or a range of columns, or the entire table. By using this range of cells, you can perform any style or operation for that particular range. The GridRangeInfo class has static methods that allow you to create a range object without explicitly creating an instance of the class.

C#

using Syncfusion.Windows.Forms.Grid;
…
GridStyleInfo style = new GridStyleInfo();
style.BackColor = Color.Blue;
GridRangeInfo range = GridRangeInfo.Cells(2, 2, 3, 3);
gridControl1.CoveredRanges.Add(range);
// Using Cols can have a range of columns from left to right (left,right).
gridControl1.ChangeCells(GridRangeInfo.Cols(4, 5),new GridStyleInfo(){Text="Columnns"});
// Selection is added to the Row.
gridControl1.Selections.Add(GridRangeInfo.Row(4));
//Change the particular cell into blue color.
gridControl1.ChangeCells(GridRangeInfo.Cell(1,1), style);
// Change cell style at particular rows.
gridControl1.ChangeCells(GridRangeInfo.Rows(6,7), new GridStyleInfo(){BackColor = Color.Green});

 

VB

Imports Syncfusion.Windows.Forms.Grid
…
Dim style As New GridStyleInfo()
style.BackColor = Color.Blue
Dim range As GridRangeInfo = GridRangeInfo.Cells(2, 2, 3, 3)
gridControl1.CoveredRanges.Add(range)
' Using Cols can have a range of columns from left to right (left,right).
gridControl1.ChangeCells(GridRangeInfo.Cols(4, 5),New GridStyleInfo() With {.Text="Columnns"})
' Selection is added to the Row.
gridControl1.Selections.Add(GridRangeInfo.Row(4))
'Change the particular cell into blue color.
gridControl1.ChangeCells(GridRangeInfo.Cell(1,1), style)
' Change cell style at particular rows.
gridControl1.ChangeCells(GridRangeInfo.Rows(6,7), New GridStyleInfo() With {.BackColor= Color.Green})

 

ranges in GridRangeInfo

Figure 1: Ranges in GirdRangeInfo

Samples:

C#: GridRangeInfo

VB: GridRangeInfo

 

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