RadialMenu control is a popup menu control included with DotNetBar for WinForms. RadialMenu control is used to minimize movement between the action which opens the menu and menu command selection. RadialMenu control is not only very useful for touch based screens but its benefits are the same when mouse only is used.

RadialMenu control provides two different types of menus:

1. MenuType = eRadialMenuType.Segment. This menu type allows showing of sub-menu items and menu item text. Following image shows this type of radial menu:

DotNetBarRadialMenu

2. MenuType = eRadialMenuType.Circular. This menu type does not allow either sub-menu items or menu item text. It only shows Symbol or Image set on menu item. Following image shows circular menu type:

DotNetBar RadialMenu Circular Menu Type

When menu is collapsed, not open, its circular button is visible on the form which when clicked opens the menu. This is what is seen when RadialMenu control is added to the form:

DotNetBar RadialMenu Open Button

RadialMenu control accepts only RadialMenuItem object type to define its menu structure. These items are added to RadialMenu.Items collection.

RadialMenu control key properties

  • BackButtonSymbol – specifies the symbol that is displayed in center of radial menu when sub-menu is shown. This button when clicked cycles back to parent menu.
  • BackButtonSymbolSize – specifies the size of the back button symbol.
  • CenterButtonDiameter – specifies the radial menu center button diameter in pixels.
  • CloseMenuOnAppDeactivate – specifies whether radial menu if its open closes when application deactivates. Its not recommended to change default setting for this property since menu will be left open and you will have to close it manually from code.
  • Colors – returns the color table that allows customization of all colors used by the radial menu control. Please see our RadialMenu sample project which is included with your DotNetBar install which shows how to use this property to customize RadialMenu colors.
  • Diameter – specifies open radial menu diameter.
  • Image – specifies image displayed on circular button which opens radial menu. Note that setting Symbol overrides the Image setting.
  • IsOpen – gets or sets whether radial menu is open. You can use this property to open radial menu from code.
  • Items – returns the collection which holds instances of RadialMenuItem objects which define the content of radial menu.
  • MaxItemPieAngle – specifies the maximum pie angle an menu item can occupy, essentially maximum radial size of menu item.
  • MaxItemRadialAngle – specifies maximum radial angle single item in menu can consume. By default this property is set to zero which indicates that radial menu is equally divided between visible menu items and constrained by MaxItemPieAngle property setting.
  • MenuLocation – specifies custom menu location in screen-coordinates. For an example of how to use this property see RadialMenu sample project which is included with your DotNetBar install.
  • MenuType – specifies the radial menu type.
  • SubMenuEdgeItemSpacing – specifies spacing between the outer edge of the radial menu item and sub menu ring.
  • SubMenuEdgeWidth – specifies width of the sub-menu ring that is drawn around the radial menu items and which shows whether an item has sub-menu and allows switch to sub-menu
  • Symbol – specifies Symbol shown on circular button which opens the radial menu. When Symbol is set it overrides Image setting.
  • SymbolSize – specifies the symbol size shown on circular button which opens radial menu.

RadialMenu control key events

  • BeforeMenuOpen – occurs before radial menu is open and it allows you to cancel opening of the menu by setting Cancel=true on event arguments.
  • ItemClick – occurs when any of the radial menu items is clicked. Can be used as single point click event handler for menu items although we recommend using Commands instead.
  • MenuClosed – occurs after radial menu is closed.
  • MenuOpened – occurs after radial menu is open.

RadialMenuItem key properties

  • Checked – specifies whether radial menu item is checked. Applies only to MenuType=Segment.
  • CircularBackColor – specifies background color for circular menu item. Applies only to MenuType=Circular.
  • CircularBorderColor – specifies border color for circular menu item. Applies only to MenuType=Circular.
  • CircularForeColor – specifies foreground color of the symbol displayed on circular menu item. Applies only to MenuType=Circular.
  • CircularMenuDiameter – specifies diameter of the circular menu item. Applies only to MenuType=Circular.
  • Command – specifies the command which is executed when menu item is clicked.
  • Image – specifies image displayed on menu item. Note that if Symbol property is set, it will override image setting.
  • IsMouseOver – returns whether mouse is over the menu item.
  • SubItems – returns collection which represents sub-menu items. You add new instances of RadialMenuItem object to this collection to create sub-menus. Note that sub-menus are visible only for MenuType=Segment.
  • Symbol – specifies symbol displayed on menu item. Note that setting Symbol will override image setting.
  • SymbolSize – specifies symbol size.
  • Text – specifies the text displayed on menu item. Note that you can use line break characters \r\n to break text into multiple lines. Applies only to MenuType=Segment.
  • TextOffset – specifies optional text offset from its original layout position. Sometimes its necessary to adjust text location for best appearance. This is property to use.
  • TextVisible – specifies whether menu item shows text if set. Applies only to MenuType=Segment.
  • TracksMouse – specifies whether menu item changes its appearance to indicates when mouse is over.

How to create RadialMenu using code

For working demonstration please see our RadialMenu sample project included with your DotNetBar install.

C#:

RadialMenu menu = new RadialMenu();
menu.Location = new Point(32,32);
menu.Symbol = "\uf040";
menu.Diameter = 220; // Make menu diameter larger
// Handle some events
menu.ItemClick += new EventHandler(RadialMenuItemClick);
menu.MenuOpened += new EventHandler(RadialMenuOpened);
menu.MenuClosed += new EventHandler(RadialMenuClosed);
 
RadialMenuItem item = new RadialMenuItem();
item.Text = "Item 1";
item.Symbol = "\uf011";
menu.Items.Add(item);
 
item = new RadialMenuItem();
item.Text = "Item 2";
item.Symbol = "\uf00e";
menu.Items.Add(item);
 
item = new RadialMenuItem();
item.Text = "Item 3";
item.Symbol = "\uf010";
menu.Items.Add(item); 
 
// Create spacer item
item = new RadialMenuItem();
menu.Items.Add(item);
 
item = new RadialMenuItem();
item.Text = "Item 4";
item.Symbol = "\uf011";
menu.Items.Add(item); 
// Add sub items to last menu item
RadialMenuItem childItem = new RadialMenuItem();
childItem.Text = "Sub menu 1";
childItem.Symbol = "\uf012";
item.SubItems.Add(childItem); // Add sub menu to its parent
 
childItem = new RadialMenuItem();
childItem.Text = "Sub\r\nmenu 2";
childItem.Symbol = "\uf013";
item.SubItems.Add(childItem);
 
this.Controls.Add(menu); // Adds menu to the form

VB:

Dim menu As New DevComponents.DotNetBar.RadialMenu()
menu.Location = New Point(32, 32)
menu.Symbol = ChrW(&HF040).ToString()
menu.Diameter = 220 ' Make menu diameter larger
' Handle some events
AddHandler menu.ItemClick, AddressOf RadialMenuItemClick
AddHandler menu.MenuOpened, AddressOf RadialMenuOpened
AddHandler menu.MenuClosed, AddressOf RadialMenuClosed
 
Dim item As New RadialMenuItem()
item.Text = "Item 1"
item.Symbol = ChrW(&HF011).ToString()
menu.Items.Add(item)
 
item = New RadialMenuItem()
item.Text = "Item 2"
item.Symbol = ChrW(&HF00E).ToString()
menu.Items.Add(item)
 
item = New RadialMenuItem()
item.Text = "Item 3"
item.Symbol = ChrW(&HF010).ToString()
menu.Items.Add(item)
 
' Create spacer item
item = New RadialMenuItem()
menu.Items.Add(item)
 
item = New RadialMenuItem()
item.Text = "Item 4"
item.Symbol = ChrW(&HF011).ToString()
menu.Items.Add(item)
' Add sub items to last menu item
Dim childItem As New RadialMenuItem()
childItem.Text = "Sub menu 1"
childItem.Symbol = ChrW(&HF012).ToString()
item.SubItems.Add(childItem) ' Add sub menu to its parent

childItem = New RadialMenuItem()
childItem.Text = "Sub" & vbCrLf & "menu 2"
childItem.Symbol = ChrW(&HF013).ToString()
item.SubItems.Add(childItem)
 
Me.Controls.Add(menu) ' Add menu to the form

Related posts:

  1. How to find CrumBarItem in CrumbBar control by name
  2. How to change the ButtonItem.Symbol property using code
  3. Getting started with DotNetBar SideNav WinForms control
  4. Everything about LayoutControl in DotNetBar for WinForms
  5. How to use ItemPanel Data-Binding Features – WinForms