Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/how-to-change-the-appearance-of-toolstrip-text-and-images-in-windows-forms.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

3.1 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Change the Appearance of ToolStrip Text and Images 03/30/2017
csharp
vb
ToolStrip control [Windows Forms], appearance
toolbars [Windows Forms], images
examples [Windows Forms], toolbars
toolbars [Windows Forms], appearance
ToolStrip control [Windows Forms], images
ToolStrip control [Windows Forms], text
toolbars [Windows Forms], text
d62dc9d1-2edd-4dfa-aed7-1335d6e13d86

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

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

To define what is displayed on a ToolStripItem

  • Set the xref:System.Windows.Forms.ToolStripItem.DisplayStyle%2A 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 xref:System.Windows.Forms.ToolStripItem.TextAlign%2A 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 xref:System.Windows.Forms.ToolStripItem.ImageAlign%2A 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 xref:System.Windows.Forms.ToolStripItem.TextImageRelation%2A 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