Share via


DataGrid.VisibleColumnCount 属性

获取可见列的数目。

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

语法

声明
Public ReadOnly Property VisibleColumnCount As Integer
用法
Dim instance As DataGrid
Dim value As Integer

value = instance.VisibleColumnCount
public int VisibleColumnCount { get; }
public:
property int VisibleColumnCount {
    int get ();
}
/** @property */
public int get_VisibleColumnCount ()
public function get VisibleColumnCount () : int

属性值

视区中可见列的数目。视区是一个矩形区域,通过它可看见网格。视区的大小取决于 System.Windows.Forms.DataGrid 控件的大小;如果允许用户调整该控件的大小,视区也将受影响。

备注

可见列的数目会因它们的宽度而变化。例如,如果为所有列设置了一个默认宽度,但将一个新列的宽度设置为默认宽度的两倍,则可见列的数目将至少减少一。

示例

下面的代码示例返回可见列的数目。

Private Function ReturnVisibleCols(ByVal myGrid As DataGrid) As Integer
    ReturnVisibleCols = myGrid.VisibleColumnCount
 End Function
    

平台

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

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

DataGrid 类
DataGrid 成员
System.Windows.Forms 命名空间
DataGrid.FirstVisibleColumn 属性
VisibleRowCount