Menu with images
-
Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.
-
Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.
I've used NewMenu in several projects. Excellent.
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
-
Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.
See Simple Bitmapped Menus[^] and http://www.codeguru.com/cpp/controls/menu/bitmappedmenus/article.php/c187/[^] for Vertical bitmap ;)
WhiteSky
-
See Simple Bitmapped Menus[^] and http://www.codeguru.com/cpp/controls/menu/bitmappedmenus/article.php/c187/[^] for Vertical bitmap ;)
WhiteSky
thanks man, I'll see right now...
-
thanks man, I'll see right now...
I hope it solved your problem.:)
WhiteSky
-
Hi fellows I need to insert an image in my menu. My menu is composed with the following strings: "New Text", "New File", "New Ruler". My menu was coded with win32, not MFC. Now the questions: 1) I've readed that I need to create owner draw menus. Is that right? 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. 3) What you recommend that I read to get a better understand of this topic and start coding? Any help is very welcomed. Again thanks for the support.
Hi Alex, Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions. 1) I've readed that I need to create owner draw menus. Is that right? Its not mandatory. 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp. Steps: HMENU Menu; Menu = CreatePopupMenu(); HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1)); HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); //Append AppendMenu(Menu, MF_STRING, 2000, "Test3333333333"); AppendMenu(Menu, MF_SEPARATOR, NULL, ""); AppendMenu(Menu, MF_STRING, 2001, "Test2"); SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1); TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL); The above steps will create 2 Menu items, one only text and other bmp with text.
Manoj Never Gives up
-
I hope it solved your problem.:)
WhiteSky
Thanks man, for your help
-
Hi Alex, Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions. 1) I've readed that I need to create owner draw menus. Is that right? Its not mandatory. 2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed. Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp. Steps: HMENU Menu; Menu = CreatePopupMenu(); HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1)); HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); //Append AppendMenu(Menu, MF_STRING, 2000, "Test3333333333"); AppendMenu(Menu, MF_SEPARATOR, NULL, ""); AppendMenu(Menu, MF_STRING, 2001, "Test2"); SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1); TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL); The above steps will create 2 Menu items, one only text and other bmp with text.
Manoj Never Gives up
Thanks for your help manoj, very thanks.... And thanks for the code, I'll test it right now
-
Thanks man, for your help
You're welcome.;)
WhiteSky