MainMenu with dynamic MenuItems

Hello,

I want to be able to change the menus at bottom of screen. My problem is that I loose the '2 big buttons layout' and has layout like menu with 3 or more MenuItems.

this.mainMenuList.MenuItems.Clear();
this.mainMenuList.MenuItems.Add(this
.miTotal);
this.mainMenuList.MenuItems.Add(this.miClose);

this.mainMenuList.MenuItems.Clear();
this.mainMenuList.MenuItems.Add(this
.miOK);
this.mainMenuList.MenuItems.Add(this.miCancel);

What do I have to do

Thanks

JF



Answer this question

MainMenu with dynamic MenuItems

  • Joshizzle

    Hello,

    I didn't try that solution.

    I decided to use 2 MenuItems and to change the Text property.

    I use the Text property to know what to do, but these solution is not correct for multi-languages applications. I will try your solution when adding a new language.

    Thanks

    JF

  • andret1802

    Have you tried to create two instances of the MainMenu class and then just switch them

    For example,

    MainMenu menu1; // contains Total and Close

    MainMenu menu2; // contains OK and Cancel

    // Set menu to Total and Close

    form.Menu = menu1;

    ...

    // Set menu to OK and Close

    form.Menu = menu2;


  • MainMenu with dynamic MenuItems