ToolBarTextAlign 枚举

定义

指定工具栏按钮控件上文本的对齐方式。

C#
public enum ToolBarTextAlign
继承
ToolBarTextAlign

字段

名称 说明
Right 1

文本与工具栏按钮图像右对齐。

Underneath 0

文本与工具栏图像底边对齐。

示例

以下示例创建一个 ToolBar 控件,设置其一些公共属性,并将其添加到 Form。 委托也会添加到 ButtonClickButtonDropDown 事件中。 此示例假定 ToolBar 已声明命名 toolBar1ImageList 命名 imageList1

C#
private void AddToolBar()
{
   // Add a toolbar and set some of its properties.
   toolBar1 = new ToolBar();
   toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
   toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.None;
   toolBar1.Buttons.Add(this.toolBarButton1);
   toolBar1.ButtonSize = new System.Drawing.Size(24, 24);
   toolBar1.Divider = true;
   toolBar1.DropDownArrows = true;
   toolBar1.ImageList = this.imageList1;
   toolBar1.ShowToolTips = true;
   toolBar1.Size = new System.Drawing.Size(292, 25);
   toolBar1.TabIndex = 0;
   toolBar1.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;
   toolBar1.Wrappable = false;
   
   // Add handlers for the ButtonClick and ButtonDropDown events.
   toolBar1.ButtonDropDown += 
     new ToolBarButtonClickEventHandler(toolBar1_ButtonDropDown);
   toolBar1.ButtonClick += 
     new ToolBarButtonClickEventHandler(toolBar1_ButtonClicked);

   // Add the toolbar to the form.
   this.Controls.Add(toolBar1);
}

注解

此枚举由成员(如 ) ToolBar.TextAlign使用。

预留了空间,以便图像显示在工具栏按钮上。 文本的对齐方式与工具栏按钮上显示的图像相关。 如果未为按钮分配图像,则保留空间将显示在所显示文本的左侧或上方。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0

另请参阅