How to configure WinForms RadialMenu and detect mouse selection in RadialMenuItems?
Configure the Radialmenu
To configure WinForms Radial Menu control, follow the steps given.
- Create a new Windows Forms Application Project in VS IDE through New Project Wizard.
- Drop a Radial Menu control in the Form.
Figure 1: RadialMenu
- The commonly used settings of the Radial Menu control are configured either through the Designer by using the Smart tag or through the Properties window. The following screenshot displays the customization of Radial Menu control through smart tag.
Figure 2: Radial Menu using smart tag
- Add the items in the Radial Menu Collection Editor.
Figure 3: Radial Menu Collection Editor
- Mouse selection in the RadialMenuItem can be detected by handling the following events:
- Click Event
When mouse selection occurs on RadialMenuItem bounds, the Click event is raised. Refer to the screenshot.
Figure 4: RadialMenuItem region
- NextLevelOpening Event
This event is raised when the Next level of the Radial Menu is opened.
Figure 5: NextLevel selection region
C#
//Hooks event for a particular RadialMenuItem and triggers event for the RadialMenuItem1. this.radialMenuItem1.Click += new EventHandler(radialMenuItem1_Click); //Hooks event for the whole RadialMenuItems. foreach (Control item in this.radialMenu1.Controls) { if (item is RadialMenuItem) item.Click += new EventHandler(item_Click); } //Event is triggered when the next level of RadialMenu is opened. this.radialMenu1.NextLevelOpening += new Syncfusion.Windows.Forms.Tools.NextMenuLevelOpening(this.radialMenu1_NextLevelOpening); void radialMenuItem1_Click(object sender, EventArgs e) { //This event is triggered when RadialMenuItem1 is clicked. MessageBox.Show("RadialMenuItem1 is Clicked"); } void item_Click(object sender, EventArgs e) { //Performs mouse click on all the RadialMenu items. if(sender is RadialMenuItem) MessageBox.Show((sender as RadialMenuItem).Text + " Clicked"); } private void radialMenu1_NextLevelOpening(object sender, Syncfusion.Windows.Forms.Tools.NextLevelOpening e) { //This event is triggered when the next level is opened by clicking the arrow button. MessageBox.Show(e.SelectedItem.Text + " Clicked" ); }
VB
'Hooks event for a particular RadialMenuItem and triggers event for RadialMenuItem1. AddHandler radialMenuItem1.Click, AddressOf radialMenuItem1_Click 'Hooks event for the whole RadialMenuItems. For Each item As Control In Me.radialMenu1.Controls If TypeOf item Is RadialMenuItem Then AddHandler item.Click, AddressOf item_Click End If Next item 'Event gets triggered when the next level of RadialMenu is opened. AddHandler radialMenu1.NextLevelOpening, AddressOf radialMenu1_NextLevelOpening Private Sub radialMenuItem1_Click(ByVal sender As Object, ByVal e As EventArgs) 'This event is triggered when RadialMenuItem1 is clicked. MessageBox.Show("RadialMenuItem1 is Clicked") End Sub Private Sub item_Click(ByVal sender As Object, ByVal e As EventArgs) 'Performs mouse click on all the RadialMenu items. If TypeOf sender Is RadialMenuItem Then MessageBox.Show((TryCast(sender, RadialMenuItem)).Text & " Clicked") End If End Sub Private Sub radialMenu1_NextLevelOpening(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Tools.NextLevelOpening) 'This event is triggered when the next level is opened by clicking the arrow button. MessageBox.Show(e.SelectedItem.Text & " Clicked") End Sub
Samples:
C#: https://www.syncfusion.com/downloads/support/directtrac/139533/ze/RadialMenu789131505
VB: https://www.syncfusion.com/downloads/support/directtrac/139533/ze/RadialMenu_VB985245079
Conclusion
I hope you enjoyed learning about how to configure WinForms RadialMenu and detect mouse selection in RadialMenuItems.
You can refer to our WinForms Radial Menu’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Radial Menu documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Radial Menu and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!