Ribbon for WinForms
メニュー
要素 > リボンアイテム > メニュー

A Menu is a button with a drop-down arrow. It is used in a ribbon application when you need a menu for a small set of related commands. If a user clicks on the arrow, then a dropdown of items is displayed.

The image below depicts the Menu item with commands such as Cut, Copy, Paste and ColorPicker.

Ribbon menu

Adding Menu at Design-Time

The Ribbon Menu can be added at design-time using the Ribbon Group Floating Toolbar or RibbonGroup Items Collection Editor. Also, you can customize the look of the Ribbon Menu using the Ribbon Menu Floating ToolBar or by editing the properties in the Properties Window. For more information about floating toolbars, refer this topic. The user can add items to the Menu using the Ribbon Menu Items Collection Editor. Refer this topic for more information on collection editors.

This image below shows the floating toolbar of Menu.

Floating toolbar

Adding Menu via Code 

A Menu can also be added to the C1Ribbon control through the code using the RibbonMenu class. This is depicted in the code below:

' リボンメニューに項目を追加します。
Dim ribbonMenu As RibbonMenu = New RibbonMenu()
ribbonMenu.Text = "Edit"
Dim cutButton As RibbonButton = New RibbonButton("Cut", Image.FromFile("images\cut.png"))
Dim copyButton As RibbonButton = New RibbonButton("Copy", Image.FromFile("images\copy.png"))
Dim pasteButton As RibbonButton = New RibbonButton("Paste", Image.FromFile("images\paste.png"))
Dim separator As RibbonSeparator = New RibbonSeparator()
Dim colorpicker1 As RibbonColorPicker = New RibbonColorPicker("Color Picker", Image.FromFile("images\fontcolor.png"))
Dim label As RibbonLabel = New RibbonLabel("Select Color")
Dim colorItem As RibbonColorPickerItem = New RibbonColorPickerItem()
ribbonMenu.Items.Add(cutButton)
ribbonMenu.Items.Add(copyButton)
ribbonMenu.Items.Add(pasteButton)
ribbonMenu.Items.Add(separator)
ribbonMenu.Items.Add(colorPicker)
ribbonMenu.Items.Add(label)
ribbonMenu.Items.Add(colorItem)
formatGroup.Items.Add(ribbonMenu)
' ドロップダウン メニューの項目のサイズを指定します。
ribbonMenu.PreferredItemSize = ItemSize.Auto
// リボンメニューに項目を追加します。
RibbonMenu ribbonMenu = new RibbonMenu();
ribbonMenu.Text = "Edit";
RibbonButton cutButton = new RibbonButton("Cut", Image.FromFile(@"images\cut.png"));
RibbonButton copyButton = new RibbonButton("Copy", Image.FromFile(@"images\copy.png"));
RibbonButton pasteButton = new RibbonButton("Paste",Image.FromFile(@"images\paste.png"));
RibbonSeparator separator = new RibbonSeparator();
RibbonColorPicker colorpicker = new RibbonColorPicker("Color Picker", Image.FromFile(@"images\fontcolor.png"));
RibbonLabel label = new RibbonLabel("Select Color");
RibbonColorPickerItem colorItem = new RibbonColorPickerItem();
ribbonMenu.Items.Add(cutButton);
ribbonMenu.Items.Add(copyButton);
ribbonMenu.Items.Add(pasteButton);
ribbonMenu.Items.Add(separator);
ribbonMenu.Items.Add(colorpicker);
ribbonMenu.Items.Add(label);
ribbonMenu.Items.Add(colorItem);
formatGroup.Items.Add(ribbonMenu);
// ドロップダウン メニューの項目のサイズを指定します。
ribbonMenu.PreferredItemSize = ItemSize.Auto;

A user can specify the item size in the dropdown menu by specifying the PreferredItemSize property. The image below depicts the Menu item in the ribbon control when the PreferredItemSize property is set to Large.

Item size