Linking the Context Menu to a NotifyIcon Control
In This Topic
C1ContextMenu supports linking to the standard NotifyIcon Control.
To link a C1ContextMenu to a NotifyIcon Control at design time, follow these steps:
- Double-click on the C1ContextMenu control to add it to the component tray. This will also add a C1ComponentHolder control to the component tray.
- Right-click on the C1ContextMenu control and select Edit from its context menu. A New Command item will appear on the form.
- Right-click the New Command item and select Edit from its context menu to open the Link to Command designer.
- Change the following command properties in the Link to Command designer:
- Change the Name textbox text to MenuFile.
- Change the Text textbox text to Menu.
- Select C1CommandMenu from the Create a new command listbox.
- Select OK in the Link to Command designer and the new menu will appear on the form.
- Right-click the New Command item in the Menu and select Edit from its context menu to open the Link to Command designer.
- Change the following properties in the Link to Command designer:
- Change the Name textbox text to OpenFile.
- Change the Text textbox tect to Open.
- Select View | Properties from the Visual Studio toolbar. Select C1ContextMenu1 from the drop-down list at the top of the Properties window.
- Set the C1ContextMenu property to C1ContextMenu1.
- Double-click the NotifyIcon component in the Windows Forms Toolbox to add the component to the component tray.
- Right-click on the component and select Choose an icon from its context menu. Choose an icon to represent the component at run time.
- Select View | Properties from the Visual Studio toolbar. Select notifyicon1 from the drop-down list at the top of the Properties window.
- Set the C1ContextMenu property to C1ContextMenu1 to link the two components.
- Run your application. The icon you chose to represent the NotifyIcon component will appear in the System Tray. Note that when you right-click the icon, the context menu opens.
This topic illustrates
Linking a C1ContextMenu to a standard Windows Forms control.
See Also