Articles in this section
Category / Section

How to use the PointToRowCol() method in WinForms GridGroupingControl?

1 min read

Use of PointToRowCol method

To retrieve the row and column index from the mouse position, the PointToRowCol() method can be used. In the below example, the row, column indices are taken from the mouse down point.


this.gridGroupingControl1.TableControl.MouseDown += TableControl_MouseDown;
void TableControl_MouseDown(object sender, MouseEventArgs e)
   System.Drawing.Point _Ponto;
   _Ponto = new System.Drawing.Point(e.X, e.Y);
   int row, col;
   gridGroupingControl1.TableControl.PointToRowCol(_Ponto, out row, out col);
   MessageBox.Show("Row :" + row + "\n" + "Col   :" + col);


Private Me.gridGroupingControl1.TableControl.MouseDown += AddressOf TableControl_MouseDown
Private Sub TableControl_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
   Dim _Ponto As System.Drawing.Point
   _Ponto = New System.Drawing.Point(e.X, e.Y)
   Dim row, col As Integer
   gridGroupingControl1.TableControl.PointToRowCol(_Ponto, row, col)
   MessageBox.Show("Row :" & row + Constants.vbLf & "Col   :" & col)
End Sub


Show the row and column count


C#: PointToRowCol

VB: PointToRowCol

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