本文介绍了在菜单栏中添加图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在菜单栏中添加图标,就像我们在绘画中观察到的一样,在vc ++ 6.0工具中使用MFC应用程序向导的Word应用程序可以告诉我添加图标的过程.

请给我最好的解决方案



在此先感谢............

Hi,

I want to add icons in the menu bar as same as we observe in the paint, word application using MFC application wizard in vc++ 6.0 tool can any one tell me the procedure to add the icons.

Please give me the best solution for this



Thanks in advance............

推荐答案

CBitmap* bitmap1 = new CBitmap;
CBitmap* bitmap2 = new CBitmap;

bitmap1->LoadBitmap( IDB_BITMAP1 );
bitmap2->LoadBitmap( IDB_BITMAP2 );
CMenu* pMenu = 0;
HMENU hMenu = 0;
pMenu = GetMenu();
pMenu = pMenu->GetSubMenu(0);
pMenu->SetMenuItemBitmaps(0, MF_BYPOSITION, bitmap1, bitmap2 );



如果是简单的SDI应用程序,则会将位图设置为文件"->新建"菜单.

不要忘记对位图对象进行Detsroy并删除CMainFrame detsructor CMainFrame ::〜CMainFrame()中的内存



in case of simple SDI application it will set a bitmap to File->New menu.

do not forget to detsroy bitmap object and delete the memory inside CMainFrame detsructor CMainFrame::~CMainFrame()


这篇关于在菜单栏中添加图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 04:36