Windows XP and MainMenu control

My MainMenu control is not rendering correctly on windows xp (with the newer shell controls). Buttons, status bar, the drop downs themselves all render properly just not the actual main menu bar. It renders with the control control instead of the menu color. Is there something I'm doing wrong or can someone else confirm (or deny) this issue for me?

Thanks,

Paul Tyng

[373 byte] By [codefund.com] at [2008-2-15]
# 1
Paul, could you put a picture up somewhere to show this? I think that in this case, it would be worth a thousand words.

I can tell you what you should expect, your menus should look like those of notepad.exe.

thanks
- mike

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
I put up some screen shots in yahoo photos:

http://photos.yahoo.com/paultyngotech

The first example shows:

Bottom window is in the .net designer (i have a manifest applied to my devenv.exe so i get themes in design view).

Next window is application running (with a manifest).

Next window is notepad (without a manifest, i'm not sure if its effected by that or not)

Top window is explorer.

Second example shows running application with manifest drop down. The drop down color is different from the bar color.

I checked my windows settings and I should see the lighter color for the menu, or maybe I'm missing something. I don't understand why the designer would differ from the running application if they both have the same manifest.

Paul Tyng

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 3
What you are seeing is the difference between a standard Win32 menu bar and a custom menu bar. Windows explorer creates a custom menu bar (which is really a rebar control), but Notepad uses a standard Win32 menu bar. Windows Form apps also use a standard Win32 menu bar, so that is why it looks like Notepad.

Now you ask why it looks different in the designer -- that is because during design time, the main menu is not really a main menu, but a designer (custom built control) that provides the ability to design your menus. This custom designer uses the menu color as its background for the main menu bar when it really should use a different value.

Hope this helps clarify things.
-mark

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 4
Yes that helps, thanks. My question now would be, shouldn't a menu bar use the menu color? Or should I inherit this control, override paint, set the base background color to transparent and then paint the menu background color myself if I want it that badly?

Thanks,

Paul Tyng

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 5
Well I personally think it depends upon if you are using theming or not. If you goto display properties on your XP computer, and on the Appearance tab, click the Advanced button, you will see a dialog. This dialog shows a preview of a window (un-themed). The main menu bar in this case will be gray, but when you click on the menubar (or select "menu" from the Item dropdown), you will notice that the "Color 1" color box has the actual color of a menu. Basically classic Win32 menus have different colors - one for the menu bar, and one for the menu itself. This corresponds to the Win32 GetSysColor API, using the COLOR_MENUBAR vs. the COLOR_MENU values.

So, it is up to you a bit -- if are creating a XP only app, you might create a custom menu bar and use the Menu color (See the CommandBar sample on http://www.aisto.com/roeder/dotnet/ for an example on using a rebar control as your main menu) to mimic the behavior of Windows Explorer. You will want to test out how your app responds though when it is run on Windows 2000 or Windows 98 (system without themes.)

-mark

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...