DataGridView.Width 属性

定义

获取或设置 DataGridView 的宽度(以磅为单位)。

public double Width { get; set; }

属性值

Double

DataGridView 的宽度(以磅为单位)。

示例

有关演示如何使用此属性的代码示例,请参见 Microsoft.Office.Tools.Excel.Controls.Button.Width 。 命名空间中的所有控件 Microsoft.Office.Tools.Excel.Controls 都具有功能等效的 Width 属性。

注解

Width 和 left 属性值所做的更改会导致 Right 更改的属性值 DataGridView

Microsoft.Office.Tools.Excel.Controls.DataGridView.Width属性使用点,而 System.Windows.Forms.Control.Width 属性使用像素。

将值设置为负数或大于12288的数字不会引发异常,但会导致控件设置为1到12288之间。

适用于