DataGrid.GetCurrentCellBounds 方法

定义

获取一个 Rectangle,它指定选定单元格的四个角。

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

返回

一个 Rectangle,它定义当前单元格的角。

示例

下面的代码示例获取 Rectangle 所选单元格的 。

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

注解

若要检索当前单元格以外的单元格的单元格边界,请使用 GetCellBounds

适用于

另请参阅