ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / Context Menu Tasks / Linking the Context Menu to a NotifyIcon Control
In This Topic
    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:

    1. Double-click on the C1ContextMenu control to add it to the component tray. This will also add a C1ComponentHolder control to the component tray.
    2. Right-click on the C1ContextMenu control and select Edit from its context menu. A New Command item will appear on the form.
    3. Right-click the New Command item and select Edit from its context menu to open the Link to Command designer.
    4. 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.
    5. Select C1CommandMenu from the Create a new command listbox.
    6. Select OK in the Link to Command designer and the new menu will appear on the form.
    7. Right-click the New Command item in the Menu and select Edit from its context menu to open the Link to Command designer.
    8. Change the following properties in the Link to Command designer:
      • Change the Name textbox text to OpenFile.
      • Change the Text textbox tect to Open.
    9. Select View | Properties from the Visual Studio toolbar. Select C1ContextMenu1 from the drop-down list at the top of the Properties window.
    10. Set the C1ContextMenu property to C1ContextMenu1.
    11. Double-click the NotifyIcon component in the Windows Forms Toolbox to add the component to the component tray.
    12. Right-click on the component and select Choose an icon from its context menu. Choose an icon to represent the component at run time.
    13. Select View | Properties from the Visual Studio toolbar. Select notifyicon1 from the drop-down list at the top of the Properties window.
    14. Set the C1ContextMenu property to C1ContextMenu1 to link the two components.
    15. 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.


    Windowd Forms control
    See Also