* 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
3.3 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Manage ToolStrip Overflow | 03/30/2017 |
|
|
fa10e0ad-4cbf-4c0d-9082-359c2f855d4e |
How to: Manage ToolStrip Overflow in Windows Forms
When all the items on a xref:System.Windows.Forms.ToolStrip control do not fit in the allotted space, you can enable overflow functionality on the xref:System.Windows.Forms.ToolStrip and determine the overflow behavior of specific xref:System.Windows.Forms.ToolStripItems.
When you add xref:System.Windows.Forms.ToolStripItems that require more space than is allotted to the xref:System.Windows.Forms.ToolStrip given the form's current size, a xref:System.Windows.Forms.ToolStripOverflowButton automatically appears on the xref:System.Windows.Forms.ToolStrip. The xref:System.Windows.Forms.ToolStripOverflowButton appears, and overflow-enabled items are moved into the drop-down overflow menu. This allows you to customize and prioritize how your xref:System.Windows.Forms.ToolStrip items properly adjust to different form sizes. You can also change the appearance of your items when they fall into the overflow by using the xref:System.Windows.Forms.ToolStripItem.Placement%2A and xref:System.Windows.Forms.ToolStripOverflow.DisplayedItems%2A?displayProperty=nameWithType properties and the xref:System.Windows.Forms.ToolStrip.LayoutCompleted event. If you enlarge the form at either design time or run time, more xref:System.Windows.Forms.ToolStripItems can be displayed on the main xref:System.Windows.Forms.ToolStrip and the xref:System.Windows.Forms.ToolStripOverflowButton might even disappear until you decrease the size of the form.
To enable overflow on a ToolStrip control
-
Ensure that the xref:System.Windows.Forms.ToolStrip.CanOverflow%2A property is not set to
falsefor the xref:System.Windows.Forms.ToolStrip. The default isTrue.When xref:System.Windows.Forms.ToolStrip.CanOverflow%2A is
True(the default), a xref:System.Windows.Forms.ToolStripItem is sent to the drop-down overflow menu when the content of the xref:System.Windows.Forms.ToolStripItem exceeds the width of a horizontal xref:System.Windows.Forms.ToolStrip or the height of a vertical xref:System.Windows.Forms.ToolStrip.
To specify overflow behavior of a specific ToolStripItem
-
Set the xref:System.Windows.Forms.ToolStripItem.Overflow%2A property of the xref:System.Windows.Forms.ToolStripItem to the desired value. The possibilities are
Always,Never, andAsNeeded. The default isAsNeeded.toolStripTextBox1.Overflow = _ System.Windows.Forms.ToolStripItemOverflow.NevertoolStripTextBox1.Overflow = _ System.Windows.Forms.ToolStripItemOverflow.Never;