$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
CommandBar Control for C# Windows Forms
Easily customize the flexible CommandBar Control in WinForms C# projects at design time
Home > WinForms UI Controls > User Manual > OverFlow Button in C#

CommandBar overflow button customizing in WinForms C# Tutorial

The WinForms CommandBar control is a powerful and easy to use user interface control for Windows Forms. This CommandBar control provides large flexibility for developers to customize it. By using the WinForms CommandBar control, developers can customize the overflow buttons easily. The following is a tutorial that illustrates the process of accessing the Overflow button in CommandBar control for Windows Forms applications and customizing items including in the Overflow button control.
In the WinForms CommandBar control, the Overflow button is contained in each Command Bar Strip Element. There is a drop down list within the Overflow button, where users can find the menu items Add or Remove Buttons, Customize and MenuSeparatorItems. The drop down list will appear when the space is not enough for the items on the control.

How to Customize Overflow Button Drop Down Menu

Developers can reference to the samples to access the menu items under the Overflow button. The CustomizeButtonMenuItem and the AddRemoveButtonsMenuItem are exposed in the following examples.

commandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.Font = new System.Drawing.Font("Arial", 12f);

commandBarStripElement1.OverflowButton.CustomizeButtonMenuItem.Font = new System.Drawing.Font("Segoe UI", 10f, FontStyle.Bold);

foreach (var item in commandBarStripElement1.OverflowButton.DropDownMenu.Items)
MenuSeparatorItem separator = item as MenuSeparatorItem;
if (separator != null)
separator.Visibility = WinFormsControls.ElementVisibility.Collapsed;
When users want to hide the complete Overflow button, it is able to configure the value of the Visibility to Collapsed to hide the Overflow button.

commandBarStripElement1.OverflowButton.Visibility = WinFormsControls.ElementVisibility.Collapsed;

How to Customize Control Context Menu

To customize the control context menu, we need to display the Customize menu option by right clicking the CommandBar control and selecting from the context menu list. The Customize menu is able to customize the strips. When the Customize menu is opened, the context menu will be populated and developers can customize the menu items.
The following C# code shows the process of subscribing this event, adding the custom item and removing the Customize option

How to Prevent Control from Gaining Focus

The default setting of the CommandBar Control allows focus receiving. If we want to disable the focus ability, we can achieve this via the following steps.
  • Create a custom class and derives from CommandBar class
  • Override the ThemeClassName property to enable the theme mechanism to recognize the new CommandBar control
  • Override the ProcessFocusRequested method and return false.
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls