Page 1 of 1

How to add custom menu item to designer menu

Posted: Wed Jun 11, 2008 12:54 pm
by fuhrj
While playing with the evaluation version in hiding certain menu options in the Designer, I see there is a way for me add a menu item.

When I try to do this, I get Object Reference Not Found error.

How do you add custom menu items? Here is my code:

StiConfig.Load()
StiMainMenuService menuSrv = StiConfig.Services.GetServices(typeof(StiMainMenuService)) as StiMainMenuService

menuSrv.AddMenuItem("Edit", "mnuTest", "Test Item", new EventHandler(this.mnuTest_Click));



How to add custom menu item to designer menu

Posted: Sun Jun 15, 2008 10:51 am
by Edward
Please use the following code for adding a button under 'Edit' Menu Items:

Code: Select all

foreach (MenuItem menuItem in this.mainMenu.MenuItems)
{
    if (menuItem.Text == Stimulsoft.Base.Localization.StiLocalization.Get("MainMenu", "menuEdit"))
    {
        MenuItem mi = new MenuItem("About", mnuTest_Click, Shortcut.None);
        menuItem.MenuItems.Add(mi);
        Stimulsoft.Controls.StiMenuProvider.AddMenuProviderToMenuItem(mi, this.MenuProvider);
    }
}
Thank you.

How to add custom menu item to designer menu

Posted: Tue Jun 17, 2008 3:02 pm
by fuhrj
Thanks Edward!

How to add custom menu item to designer menu

Posted: Thu Jun 19, 2008 1:21 am
by Edward
You are welcome.

Please let us know if any help is required.

Thank you.