ToolStripItem.Alignment Property

Gets or sets a value indicating whether the item aligns towards the beginning or end of the ToolStrip.

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

public ToolStripItemAlignment Alignment { get; set; }
/** @property */
public ToolStripItemAlignment get_Alignment ()

/** @property */
public void set_Alignment (ToolStripItemAlignment value)

public function get Alignment () : ToolStripItemAlignment

public function set Alignment (value : ToolStripItemAlignment)

Not applicable.

Property Value

One of the ToolStripItemAlignment values. The default is Left.

Exception typeCondition


The value assigned is not one of the ToolStripItemAlignment values.

In a stack overflow layout, use the Alignment property along with the ToolStripItem.RightToLeft property to control the end to which items are aligned in a ToolStrip, or to determine the end to which they are already aligned.

If the ToolStripItem.RightToLeft property is No, items marked as Left are aligned to the left side of the ToolStrip and items marked Right are aligned to the right.

If the ToolStripItem.RightToLeft property is Yes, items marked as Left are aligned to the right side of the ToolStrip and items marked Right are aligned to the left.


In flow and table layouts, the Alignment property is ignored. In flow or table layout, use the Dock or Anchor property to align the items within the row or table cell.

The following code example demonstrates how to set the Alignment property. This code example is part of a larger example provided for the ToolStripItem class.

// This utility method creates a RolloverItem 
// and adds it to a ToolStrip control.
private RolloverItem CreateRolloverItem(
    ToolStrip owningToolStrip,
    string txt,
    Font f,
    string imgKey,
    TextImageRelation tir,
    string backImgKey)
    RolloverItem item = new RolloverItem();

    item.Alignment = ToolStripItemAlignment.Left;
    item.AllowDrop = false;
    item.AutoSize = true;

    item.BackgroundImage = owningToolStrip.ImageList.Images[backImgKey];
    item.BackgroundImageLayout = ImageLayout.Center;
    item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
    item.DoubleClickEnabled = true;
    item.Enabled = true;
    item.Font = f;

    // These assignments are equivalent. Each assigns an
    // image from the owning toolstrip's image list.
    item.ImageKey = imgKey;
    //item.Image = owningToolStrip.ImageList.Images[infoIconKey];
    //item.ImageIndex = owningToolStrip.ImageList.Images.IndexOfKey(infoIconKey);
    item.ImageScaling = ToolStripItemImageScaling.None;

    item.Owner = owningToolStrip;
    item.Padding = new Padding(2);
    item.Text = txt;
    item.TextAlign = ContentAlignment.MiddleLeft;
    item.TextDirection = ToolStripTextDirection.Horizontal;
    item.TextImageRelation = tir;

    return item;

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

Community Additions