ToolBarTextAlign Enumeration

Specifies the alignment of text on the toolbar button control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public enum ToolBarTextAlign
public enum ToolBarTextAlign
public enum ToolBarTextAlign

 Member nameDescription
RightThe text is aligned to the right of the toolbar button image. 
UnderneathThe text is aligned underneath the toolbar button image. 

This enumeration is used by members such as ToolBar.TextAlign.

Room is reserved for an image to be displayed on toolbar buttons. The alignment of text is in relation to the image displayed on the toolbar button. If no image is assigned to the button, the reserved space will appear to the left, or above the text displayed.

The following example creates a ToolBar control, sets some of its common properties, and adds it to a Form. Delegates are also added to the ButtonClick and ButtonDropDown events. This example assumes a ToolBar named toolBar1 and an ImageList named imageList1 have been declared.

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.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.

private void AddToolBar()
    // Add a toolbar and set some of its properties.
    toolBar1 = new ToolBar();
    toolBar1.set_ButtonSize(new System.Drawing.Size(24, 24));
    toolBar1.set_Size(new System.Drawing.Size(292, 25));
    // Add handlers for the ButtonClick and ButtonDropDown events.
    toolBar1.add_ButtonDropDown(new ToolBarButtonClickEventHandler
    toolBar1.add_ButtonClick(new ToolBarButtonClickEventHandler
    // Add the toolbar to the form.
} //AddToolBar

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions