Export (0) Print
Expand All
Expand Minimize

How to: Change the Appearance of ToolStrip Text and Images in Windows Forms

You can control whether text and images are displayed on a ToolStripItem and how they are aligned relative to each other and the ToolStrip.

To define what is displayed on a ToolStripItem

  • Set the DisplayStyle property to the desired value. The possibilities are Image, ImageAndText, None, and Text. The default is ImageAndText.

    toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
    

To align text on a ToolStripItem

  • Set the TextAlign property to the desired value. The possibilities are any combination of top, middle, and bottom with left, center, and right. The default is MiddleCenter.

    toolStripSplitButton1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    

To align an image on a ToolStripItem

  • Set the ImageAlign property to the desired value. The possibilities are any combination of top, middle, and bottom with left, center, and right. The default is MiddleLeft.

    toolStripSplitButton1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
    

To define how ToolStripItem text and images are displayed relative to each other

  • Set the TextImageRelation property to the desired value. The possibilities are ImageAboveText, ImageBeforeText, Overlay, TextAboveImage, and TextBeforeImage. The default is ImageBeforeText.

    toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
    
Show:
© 2015 Microsoft