Change fg/bg Colour for menu items [MSW2.9]

Andreas Oppermann Andreas-Oppermann at oss-gmbh.de
Wed Oct 31 02:50:48 PDT 2007


I get the menu via XRC:  menubar = wxXmlResource::Get ()->LoadMenuBar (this, 
wxT("hauptmenu"));

I tried to change the colour like this:
wxColour fg (0xF4, 0xF4, 0xF4);
wxColour bg (0x2D, 0x2D, 0x2D);

for (int f = 0; f < (int) bar->GetMenuCount (); f++)
{
    wxMenu *menu = bar->GetMenu (f);
    for (int ff = 0; ff < (int) menu->GetMenuItemCount (); ff++)
    {
        wxMenuItem *item = menu->FindItemByPosition (ff);
        item->SetTextColour (fg);
        item->SetBackgroundColour (bg);
        item->SetOwnerDrawn (true);
    }
}
bar->Refresh ();

Only the regular system colours appear.
Any hint will be very welcome.

Best,
Andreas Oppermann








More information about the wx-users mailing list