Share via


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
    
    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
    
    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
    
    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
    
    toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
    

See Also

Concepts

ToolStrip Control Architecture

ToolStrip Technology Summary

Reference

ToolStrip Control Overview (Windows Forms)

ToolStrip