ListBox.SetBoundsCore 方法

此方法支持 .NET 基础结构,但不适合在代码中直接使用。

设置 ListBox 控件的指定边界。

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

语法

声明
Protected Overrides Sub SetBoundsCore ( _
    x As Integer, _
    y As Integer, _
    width As Integer, _
    height As Integer, _
    specified As BoundsSpecified _
)
用法
Dim x As Integer
Dim y As Integer
Dim width As Integer
Dim height As Integer
Dim specified As BoundsSpecified

Me.SetBoundsCore(x, y, width, height, specified)
protected override void SetBoundsCore (
    int x,
    int y,
    int width,
    int height,
    BoundsSpecified specified
)
protected:
virtual void SetBoundsCore (
    int x, 
    int y, 
    int width, 
    int height, 
    BoundsSpecified specified
) override
protected void SetBoundsCore (
    int x, 
    int y, 
    int width, 
    int height, 
    BoundsSpecified specified
)
protected override function SetBoundsCore (
    x : int, 
    y : int, 
    width : int, 
    height : int, 
    specified : BoundsSpecified
)

参数

  • x
    控件的新 Left 属性值。
  • y
    控件的新 Top 属性值。
  • width
    控件的新 Width 属性值。
  • height
    控件的新 Height 属性值。

备注

ListBox 控件的高度按 ItemHeight 属性的倍数增加或减少。如果表示高度的数字不是 ItemHeight 的倍数,则 ListBox 的高度将按小于高度的最大倍数而更改。

通常,当传入与未包含在指定参数中的边界对应的参数时,会使用它们的当前值。例如,Location 属性的 height、width 或 x 或 y 属性可以用对控件的当前实例的引用传入。但是,所有传入的值都是有效的,并应用到控件中。

specified 参数表示由应用程序更改了的控件 Bounds 的元素。例如,如果更改了控件的 Size,则 specified 参数值为 Size。但是,如果为响应正在设置的 Dock 属性而调整了 Size,则 specified 参数值为 None

给继承者的说明 在派生类中重写 SetBoundsCore 时,请确保调用了基类的 SetBoundsCore 方法,以强制更改控件的边界。派生类可以在 SetBoundsCore 方法中添加大小限制。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、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

请参见

参考

ListBox 类
ListBox 成员
System.Windows.Forms 命名空间