DataGrid.GetCurrentCellBounds 方法

定义

获取一个 Rectangle,它指定选定单元格的四个角。Gets a Rectangle that specifies the four corners of the selected cell.

public:
 System::Drawing::Rectangle GetCurrentCellBounds();
public System.Drawing.Rectangle GetCurrentCellBounds ();
member this.GetCurrentCellBounds : unit -> System.Drawing.Rectangle
Public Function GetCurrentCellBounds () As Rectangle

返回

Rectangle

一个 Rectangle,它定义当前单元格的角。A Rectangle that defines the current cell's corners.

示例

下面的代码示例获取 Rectangle 选定单元格的。The following code example gets the Rectangle of the selected cell.

private:
   void dataGrid1_CurrentCellChange( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      Rectangle rect;
      rect = dataGrid1->GetCurrentCellBounds();
      Console::WriteLine( rect );
   }
private void dataGrid1_CurrentCellChange(object sender, EventArgs e)
 {
    Rectangle rect;
    rect = dataGrid1.GetCurrentCellBounds();
    Console.WriteLine(rect.ToString());
 }
 
Private Sub DataGrid1_CurrentCellChange(ByVal sender As Object, ByVal e As EventArgs)
    Dim rect As Rectangle
    rect = DataGrid1.GetCurrentCellBounds()
    Console.WriteLine(rect.ToString)
 End Sub
 

注解

若要检索当前单元格以外的单元格边界,请使用 GetCellBoundsTo retrieve the cell bounds for a cell other than the current cell, use GetCellBounds.

适用于

另请参阅