Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a menu with pics instead of text

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hello, all!

I need a menu with pictures (bitmaps) instead of usual text in menu's items.

I did it this way:
Code:
CBitmap b1, b2;
b1.LoadBitmap(IDB_BITMAP1);
b2.LoadBitmap(IDB_BITMAP3);
CMenu menu;
menu.LoadMenu(IDR_STMENU);
menu.SetMenuItemBitmaps(IDC_BEZ1, MF_BYCOMMAND, &b1, &b1);
menu.SetMenuItemBitmaps(IDC_BEZ2, MF_BYCOMMAND, &b2, &b2);
CPoint pt;
GetCursorPos((LPPOINT)&pt);
menu.GetSubMenu(2)->TrackPopupMenu(TPM_CENTERALIGN, pt.x, pt.y, &m_Grid);
menu.DestroyMenu();
b1.DeleteObject();
b2.DeleteObject();
Also it is nessary to set the text in the menu items to " " otherwise there will be only separators instead of pics.

What I get is a menu with pics, BUT these pics are cut to the size of usual menu pics!! AND there is some place to the right of each pic as if there should be some text.

Any ideas??!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top