TextBoxBase.PreferredHeight 属性

获取文本框的首选高度。

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

语法

声明
Public ReadOnly Property PreferredHeight As Integer
用法
Dim instance As TextBoxBase
Dim value As Integer

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

属性值

文本框的首选高度。

备注

此属性返回的大小值取决于文本框的字体高度和边框样式。可以使用此属性确定文本框合适的大小,以确保文本正确地显示在控件中。此属性返回的值是以像素为单位的。

PreferredHeight 的值表示为了在不用裁剪文本的情况下显示文本,文本框所需的最低高度。无论 Multiline 属性设置为 true 还是 false,此值都准确。如果 WordWrap 属性设置为 true,而且文本框的宽度很小,导致出现自动换行,则 PreferredHeight 可能增加,从而创建更多垂直行。

平台

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

请参见

参考

TextBoxBase 类
TextBoxBase 成员
System.Windows.Forms 命名空间
TextBoxBase.AutoSize 属性