ContentAlignment 枚举
指定绘图表面上内容的对齐方式。
**命名空间:**System.Drawing
**程序集:**System.Drawing(在 system.drawing.dll 中)
语法
声明
Public Enumeration ContentAlignment
用法
Dim instance As ContentAlignment
public enum ContentAlignment
public enum class ContentAlignment
public enum ContentAlignment
public enum ContentAlignment
成员
成员名称 | 说明 | |
---|---|---|
BottomCenter | 内容在垂直方向上底边对齐,在水平方向上居中对齐。 | |
BottomLeft | 内容在垂直方向上底边对齐,在水平方向上左边对齐。 | |
BottomRight | 内容在垂直方向上底边对齐,在水平方向上右边对齐。 | |
MiddleCenter | 内容在垂直方向上中间对齐,在水平方向上居中对齐。 | |
MiddleLeft | 内容在垂直方向上中间对齐,在水平方向上左边对齐。 | |
MiddleRight | 内容在垂直方向上中间对齐,在水平方向上右边对齐。 | |
TopCenter | 内容在垂直方向上顶部对齐,在水平方向上居中对齐。 | |
TopLeft | 内容在垂直方向上顶部对齐,在水平方向上左边对齐。 | |
TopRight | 内容在垂直方向上顶部对齐,在水平方向上右边对齐。 |
示例
下面的代码示例演示如何使用 System.Drawing.Point 和 Size 构造函数以及 System.Drawing.ContentAlignment 枚举。若要运行此示例,请将此代码粘贴到一个包含名为 Label1
的标签的 Windows 窗体中,并在该窗体的构造函数中调用 IntializeLabel1
方法。
Private Sub InitializeLabel1()
' Set a border.
Label1.BorderStyle = BorderStyle.FixedSingle
' Set the size, constructing a size from two integers.
Label1.Size = New Size(100, 50)
' Set the location, constructing a point from a 32-bit integer
' (using hexadecimal).
Label1.Location = New Point(&H280028)
' Set and align the text on the lower-right side of the label.
Label1.TextAlign = ContentAlignment.BottomRight
Label1.Text = "Bottom Right Alignment"
End Sub
private void InitializeLabel1()
{
// Set a border.
Label1.BorderStyle = BorderStyle.FixedSingle;
// Set the size, constructing a size from two integers.
Label1.Size = new Size(100, 50);
// Set the location, constructing a point from a 32-bit integer
// (using hexadecimal).
Label1.Location = new Point(0x280028);
// Set and align the text on the lower-right side of the label.
Label1.TextAlign = ContentAlignment.BottomRight;
Label1.Text = "Bottom Right Alignment";
}
void InitializeLabel1()
{
// Set a border.
Label1->BorderStyle = BorderStyle::FixedSingle;
// Set the size, constructing a size from two integers.
Label1->Size = System::Drawing::Size( 100, 50 );
// Set the location, constructing a point from a 32-bit integer
// (using hexadecimal).
Label1->Location = Point(0x280028);
// Set and align the text on the lower-right side of the label.
Label1->TextAlign = ContentAlignment::BottomRight;
Label1->Text = "Bottom Right Alignment";
}
private void Initializelabel1()
{
// Set a border.
label1.set_BorderStyle(BorderStyle.FixedSingle);
// Set the size, constructing a size from two integers.
label1.set_Size(new Size(100, 50));
// Set the location, constructing a point from a 32-bit integer
// (using hexadecimal).
label1.set_Location(new Point(0x280028));
// Set and align the text on the lower-right side of the label.
label1.set_TextAlign(ContentAlignment.BottomRight);
label1.set_Text("Bottom Right Alignment");
} //Initializelabel1
平台
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