We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the coordinates of current cell in WinForms GridControl?

Platform: WinForms |
Control: GridControl

Position of current cell

To retrieve the co-ordinates of the current cell in GridControl, you can use the RangeInfoToRectangle() method. It converts the RangeInfo of the current cell to a rectangle-like object. Using this rectangle, you can get the co-ordinates like Top, Left, Height and Width.


//Hook the MouseClick event to find the co-ordinates of the current cell.
this.gridControl1.MouseClick += gridControl1_MouseClick;
void gridControl1_MouseClick(object sender, MouseEventArgs e)
    //Get CurrentCell from Grid.
    GridCurrentCell cc = this.gridControl1.CurrentCell;
    //Get the rectangular RangeInfo of CurrentCell.
    Rectangle cellRect = this.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex));
    //Display the coordinates of the CurrentCell.


'Hook the MouseClick event to find the co-ordinates of the current cell.
Private Me.gridControl1.MouseClick += AddressOf gridControl1_MouseClick
Private Sub gridControl1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    'Get CurrentCell from Grid.
    Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
    'Get the rectangular RangeInfo of CurrentCell.
    Dim cellRect As Rectangle = Me.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex))
    'Display the coordinates of the CurrentCell.
End Sub

The following screenshot displays the coordinates of the CurrentCell.

Show the current cell position

Figure 1: Output


C#: CurrentCellPosition

VB: CurrentCellPosition


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile