Click to See Complete Forum and Search --> : Owner draw menus


Some12k
November 21st, 2005, 04:04 AM
I tried making an owner drawn menu but I only succeeded owner-drawing only each menu item separately but not the menu background itself or top-level items (like File, Edit etc).

Marc G
November 21st, 2005, 05:17 AM
Take a look at some of the articles at http://www.codeguru.com/Cpp/controls/menu/

Some12k
November 21st, 2005, 01:07 PM
Marc G thanks for your reply but all those articles are for MFC :)

Marc G
November 22nd, 2005, 07:32 AM
That might be the case, however, it shouldn't be that hard to translate it from MFC code to standard Win32 API code because the owner drawing concept is the same for both.

Some12k
November 23rd, 2005, 12:38 PM
That might be the case, however, it shouldn't be that hard to translate it from MFC code to standard Win32 API code because the owner drawing concept is the same for both.

Yeap thats true, the problem is, I know nothing about MFC :D

Marc G
November 24th, 2005, 01:19 PM
It's kind of hard to explain exactly how to convert something from MFC to Win32 API through the use of a forum. Just give it a try :)
Most things in MFC have exact counterparts in Win32 API. For example:
CBrush would be HBRUSH
CPen would be HPEN
CDC would be HDC
So if you see something like:
CPen mypen(PS_SOLID, 1, RGB(0,0,0));
You can translate that to
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
Window messages in MFC are handles as callback functions. For example: in MFC you could have an OnMeasureItem function which is the function that will be called by MFC in response to a WM_MEASUREITEM message.

Some12k
November 25th, 2005, 01:35 PM
Ok, thanks, I'll try :)

Marc G
November 26th, 2005, 12:31 PM
Ok :)

If you encounter more specific problems, you can always ask them on codeguru :wave: