Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
, andText
. The default isImageAndText
.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
, andTextBeforeImage
. The default isImageBeforeText
.ToolStripButton1.TextImageRelation = _ System.Windows.Forms.TextImageRelation.ImageAboveText
toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
See also
.NET Desktop feedback