Hi Timo!
Do You have any examples how to customize menu font and size?
I can change main menus font and size, but how about sub items?
Best Regards
Meelis
Toolbar as Menubar and fonts
Re: Toolbar as Menubar and fonts
Found another solution, but this code has a nasty GDI leak.
http://www.vbforums.com/attachment.php? ... 1156934327
http://www.vbforums.com/attachment.php? ... 1156934327
Re: Toolbar as Menubar and fonts
Well, the sub menus are popup menus (CreatePopupMenu) and Windows doesn't provide a way to customize the font of menu items. So the only way would be make the popup menus owner-drawn. I do this in the Office Style sample app. In this sample, I do not change the font of sub menu items, but I owner-draw them. Changing the font would be as simple as calling SelectObject(hDC, hFont) before drawing (don't forget to restore the old font after drawing).
Regards
TiKu
Regards
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Toolbar as Menubar and fonts
Thnx, for thw answer.TiKu wrote:Well, the sub menus are popup menus (CreatePopupMenu) and Windows doesn't provide a way to customize the font of menu items. So the only way would be make the popup menus owner-drawn. I do this in the Office Style sample app. In this sample, I do not change the font of sub menu items, but I owner-draw them. Changing the font would be as simple as calling SelectObject(hDC, hFont) before drawing (don't forget to restore the old font after drawing).
Regards
TiKu
If you have time, can you test and comment this code and GDI leak, please?
http://www.vbforums.com/attachment.php? ... 1156934327
Re: Toolbar as Menubar and fonts
I did only read over the code, but could not find any obvious GDI leak.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Toolbar as Menubar and fonts
OK is it normal - if you start the program there are (lets say) 200 GDI objects.
Click on first menu, GDI objects are now 206. Close menu. GDI objetcs 205. Open menu GDI objetcs 212 aso.
In my application after 10 min using there was over 1000 GDI objects and this only after clicking on menus
You can test it with this sample application
Open first menu and move mouse over menus, GDI objects are growing and growing.
It think the problem is with menu images, if you disable menu images/buttons then GDI obects are not growing.
Click on first menu, GDI objects are now 206. Close menu. GDI objetcs 205. Open menu GDI objetcs 212 aso.
In my application after 10 min using there was over 1000 GDI objects and this only after clicking on menus
You can test it with this sample application
Open first menu and move mouse over menus, GDI objects are growing and growing.
It think the problem is with menu images, if you disable menu images/buttons then GDI obects are not growing.
Re: Toolbar as Menubar and fonts
Well, after a deeper look, I can tell you that some parts of the code are really horrible:
TiKu
- DrawEmbossed creates quite a few GDI objects but deletes none of them. This is the main problem.
- m_MenuFont is never deleted - should be done in Class_Terminate.
- GetDC is called twice without calling ReleaseDC.
- ImageList_GetIcon is called without destroying the icon (which is never used by the way).
- The code often calls GetSysColor and uses the result for calling CreateSolidBrush. What's wrong with GetSysColorBrush?
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Toolbar as Menubar and fonts
Thank you!
Maybe you know any other good solution how to change menu font or just increase font size ?
Maybe you know any other good solution how to change menu font or just increase font size ?
Re: Toolbar as Menubar and fonts
No, owner-drawing the items is the way to go.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: Toolbar as Menubar and fonts
OK improved the code and now all gdi objects are destroyed.
of course mu gdi, api skills are zero , but its working and gdi objects are not growing anymore .
Thank you again!
Meelis
of course mu gdi, api skills are zero , but its working and gdi objects are not growing anymore .
Thank you again!
Meelis