|
I have an MDI app and the system menu is drawn very strangely. Move, Size, and Maximize have only their text displayed, and Restore, Minimize, and Close only have their icon displayed. I am using the default menus. Any ideas on what is causing the problem?
|
|
|
|
|
I can confirm this behaviour, but only on Windows XP, and only with MDI applications, including the example provided. On Windows 2000, and on Windows ME, the behaviour is correct.
When using Word XP, the system menu doesn't get the visual styles, so I suspect that it's necessary to find a way to exclude the system menu from this special handling. I tested a bit, and found that the OnDrawItem only gets called for those entries that look correctly - it doesn't get called for those entries that look strange.
|
|
|
|
|
In MenuXP.h Line 79, you can suppress the comment.
System menus will be unhandled. But their borders will stay flat !
The result is strange, but it works...
Regards
|
|
|
|
|
On XP, the system would automatically draw the shadow. How do I disable it only for my APP?
Stephane
|
|
|
|
|
The menu bar can change in my application. I got it to work by issuing CMenuXP::UpdateMenuBar(this)after SetMenu(...) to the new menu bar. I assume this will not cause problems.
I notice that DPI settings other than 100% are not handled correctly.
Some of my toolbars are oversized with large icons and that causes some display problems.
Otherwise, I am pleasantly surprised that the code handles all these situations without breaking.
|
|
|
|
|
Is There Any Chance Of An OCX Version?
Kind Regards
Gary
|
|
|
|
|
Hi!
MenuXP_src.zip - Tools - MenuXP.cpp - should be:
bool CMenuItem::Draw( ) const<br />
{<br />
<br />
rc.right = rc.left + IMGWIDTH+IMGPADDING;<br />
pDC->FillSolidRect (rc, HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), +20, 0));<br />
<br />
<br />
rc.left += IMGWIDTH+IMGPADDING+TEXTPADDING;<br />
pDC->DrawText (sCaption, rc, DT_SINGLELINE|DT_VCENTER|DT_LEFT|dwHidePrefix);<br />
<br />
}
It's proper for a "column break" or "bar break" option.
Sincerely Yours,
Kris Wojtas
|
|
|
|
|
In source files and on this page I don't found any license agreements...
|
|
|
|
|
Hello
This is very nice, but how do you add icons to the various menu items?
Hope someone can help
Thanks
Alex
|
|
|
|
|
Yo, I can't get this working either. There is a simple example (onInitDialog):
CImageList m_imgList;
m_imgList.Create (IDB_BITMAP1, 16, 0, RGB(192,192,192));
CMenuXP::SetMenuItemImage (ID_APP_ABOUT, m_imgList, 0);
CMenuXP::SetMenuItemImage (ID_FILE_ITEM1, m_imgList, 1);
CMenuXP::SetMenuItemImage (ID_FILE_ITEM2, m_imgList, 2);
CMenuXP::SetMenuItemImage (ID_FILE_ITEM3, m_imgList, 3);
but I can't get it to work for me. My create bitmap is good, but the SetMenuItemImage does nothing
aaaaaahhhhhhh!!!
|
|
|
|
|
I'm looking at the SDI example; how the menu icons are added is a TOTAL mystery, there is no code involved at all! The menu icons are just there by some weird Microsoft magic. God I hate VC++ somethings!
|
|
|
|
|
Yeah, this seems like a mystery at first, but it's automatically figured out by matching resource IDs between menus and toolbars.
A toolbar gets its icons through a single BMP file in your res folder. VC automatically edits it as you edit the toolbar in the resource editor.
Example: I have a menu resource with an ID of IDR_MAINFRAME. I also have a toolbar resource with an ID of IDR_MAINFRAME.
I have a button on my toolbar with an ID of ID_FILE_OPEN. I also have a menu item on my menu with an ID of ID_FILE_OPEN. Whatever icon the toolbar button has, the menu item will have.
I hope this helps.
|
|
|
|
|
Is it possible to popup a menu at tray icon and apply a flat style to it?
Because the parent wnd of this menu is a hidden dialog, the menu can only apply flat style within this dialog.
|
|
|
|
|
I use a popup menu in conditions you describe (hidden window) and I have no problem. I suggest that you write a small sample. If you experience some problems, send it to me, I'll correct it. After that, We can publish this sample to help anyone that try to do the same thing.
|
|
|
|
|
Followed the instructions fully, except my call to UpdateMenuBar is in the LoadFrame method of the MainFrm class file. There's no OnUpdateFrameMenu method of ChildFrm for an MDI app that I can see.
I'm using VC6.0 on Win2K.
Any ideas?
|
|
|
|
|
Putting it in a CMDIFrameWnd derived class won't work, at least for me.
CMDIChildWnd does have this method. If the wizard doesn't display it, then override it manually. It's exactly how I implemented it in my copy of VC6.
Also, if you don't automatically open a child window on application start, then read my post above about MDI apps.
|
|
|
|
|
BTW thanks for replying.
Here's what I have:
void CChildFrame::OnUpdateFrameMenu (BOOL bActivate, CWnd* pActivateWnd, HMENU hMenuAlt)
{
CMDIChildWnd::OnUpdateFrameMenu (bActivate, pActivateWnd, hMenuAlt);
CMenuXP::UpdateMenuBar (GetMDIFrame());
}
and
BOOL CChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
// Comment out this line to deactivate the XP Look & Feel
CMenuXP::SetXPLookNFeel (this,TRUE);
return CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext);
}
Not sure what else to try.
|
|
|
|
|
Take a look at the modified version below. The hMenu check isn't required, but it's in there to be safe. You want the SetXPLookNFeel() call in this method. You do not want any of this code in your Create() method as the actual window has not been created yet.
I think you may have confused Create() with OnCreate(). Your CMainFrame should have the SetXPLookNFeel() call in its OnCreate() method AFTER the Create() method has been called. Nothing is required in the OnCreate() on your ChildFrame class.
I hope this clears things up.
//Modified method
void CChildFrame::OnUpdateFrameMenu (BOOL bActivate, CWnd* pActivateWnd, HMENU hMenuAlt)
{
CMDIChildWnd::OnUpdateFrameMenu (bActivate, pActivateWnd, hMenuAlt);
CMenuXP::UpdateMenuBar(GetMDIFrame());
HMENU hMenu = GetSystemMenu(false)->GetSafeHmenu();
if ( hMenu != NULL )
{
CMenuXP::SetXPLookNFeel(this, hMenu, true);
}
}
}
|
|
|
|
|
The download says:
Download source files - 78 Kb (With project files for VC6 and Visual Studio .NET)
I see only a .Net Solution file, I can't locate any other .Net files. Does this not work with .Net?
I need menus just like this but can't find any for .Net without paying out the booty.
|
|
|
|
|
The .Net Solution file contains three VC7 projects.
The CMenuXP class is compatible with VC6 and VC7.
|
|
|
|
|
I'm not sure what that means. I never done any C++ programming. I've only used VB and VB.Net. I'm just looking for a way to be able to use the CMenuXP class in my .net project.
I think I know what you mean. I don't really think I need any project files. I'll look again at the package I downloaded a while ago. If theres a dll file I'll try to reference that in my .net project... but I don't know how to implement anything, if it's even possable.
|
|
|
|
|
For .Net the best Open Source library with XP Look And Feel is dotNetMagic, try it http://www.dotnetmagic.com/
|
|
|
|
|
i found some comercial solutions to make office2003 style-toolbars in c++. is there any free code for doing this? can this really be so difficult??
thanx for any input!
andreas
|
|
|
|
|
Hi,
How should i use these XP Style menu classes in my ATL Composite control that has MFC support.
I am unable to use it there???
Required needful help
Regards,
Susheel
Susheel Chauhan
|
|
|
|
|
The CMenuXP drawed is much wider than default!
so the menubar can not contains many submenu!
Then, when i use SetMenu in CMainFrame to switch mainmenu, there is repaint problom, because default menu length is much more narrow
Is the gap too bigger between menuitem in menubar?
|
|
|
|