The code you've quoted is what provides the Win11 style, using the VSCLASS_MENU theme data. To compare this with the XP style you can comment out the following lines:
That will stop the VSCLASS_MENU theme data from being loaded.
If you download the latest snapshot from the code section you will find the following entries in CMainFrame::OnCreate in the Frame sample:
// UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar.// UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar.// UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items.// UseReBar(FALSE); // Don't use a ReBar.// UseStatusBar(FALSE); // Don't use a StatusBar.// UseThemes(FALSE); // Don't use themes.// UseToolBar(FALSE); // Don't use a ToolBar.
If you remove the comment from in from of UseOwnerDrawnMenu, the popup menu will be drawn in its native style without any owner draw. Note that the native style doesn't draw any icons from the toolbar in the popup menu.
Best regards,
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Win32++, we can turn off owner draw for menu items by removing the comment in front of UseOwnerDrawnMenu in CMainFrame::OnCreate (as described in the previous post).
When we turn off the owner draw for the menu items in Win32++, the style will match the Notepad++ menu style precisely.
Best regards,
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi David,
I found that the style of popup menu in win32++ is very close to xp, it may be related to the following code,
How can I change its style, such as the native style of Win11?
Looking forward to your answer, thank you!
Thanks,
Zhang
Hi Zhang,
The code you've quoted is what provides the Win11 style, using the VSCLASS_MENU theme data. To compare this with the XP style you can comment out the following lines:
That will stop the VSCLASS_MENU theme data from being loaded.
If you download the latest snapshot from the code section you will find the following entries in CMainFrame::OnCreate in the Frame sample:
If you remove the comment from in from of UseOwnerDrawnMenu, the popup menu will be drawn in its native style without any owner draw. Note that the native style doesn't draw any icons from the toolbar in the popup menu.
Best regards,
David
How can I implement a menu theme like notepad++?
Notpad++ doesn't use owner draw for its menus.
In Win32++, we can turn off owner draw for menu items by removing the comment in front of UseOwnerDrawnMenu in CMainFrame::OnCreate (as described in the previous post).
When we turn off the owner draw for the menu items in Win32++, the style will match the Notepad++ menu style precisely.
Best regards,
David
Thank you very much David.