2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Position of current cellTo 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. C# //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. MessageBox.Show(cellRect.ToString()); } VB '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. MessageBox.Show(cellRect.ToString()) End Sub The following screenshot displays the coordinates of the CurrentCell. Figure 1: Output Samples:
|
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.