Share via


DataGrid.GetCurrentCellBounds 方法

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

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Function GetCurrentCellBounds As Rectangle
用法
Dim instance As DataGrid
Dim returnValue As Rectangle

returnValue = instance.GetCurrentCellBounds
public Rectangle GetCurrentCellBounds ()
public:
Rectangle GetCurrentCellBounds ()
public Rectangle GetCurrentCellBounds ()
public function GetCurrentCellBounds () : Rectangle

返回值

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

示例

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

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
 
private void dataGrid1_CurrentCellChange(object sender, EventArgs e)
 {
    Rectangle rect;
    rect = dataGrid1.GetCurrentCellBounds();
    Console.WriteLine(rect.ToString());
 }
 
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());
} //dataGrid1_CurrentCellChange

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataGrid 类
DataGrid 成员
System.Windows.Forms 命名空间
GetCellBounds