如何在VS2010MFC应用程序菜单项添加菜单图标?

如何在VS2010MFC应用程序菜单项添加菜单图标?,第1张

try this code:
BOOL CMainFrame::OnShowPopupMenu(CMFCPopupMenu pMenuPopup)
{
if(pMenuPopup)
{
int iIndex = -1;
CMFCPopupMenuBar pMenuBar = pMenuPopup->GetMenuBar();
if (!CMFCToolBar::IsCustomizeMode()&& (NULL != pMenuBar) && (iIndex=pMenuBar->CommandToIndex(ID_EDIT_PASTE))>=0)
{
pMenuPopup->InsertSeparator(iIndex+1);
pMenuPopup->InsertItem(CMFCToolBarMenuButton(IDS_EDIT_MYITEM_1,NULL,-1,_T("&MyItem 1")),iIndex+2);
pMenuPopup->InsertItem(CMFCToolBarMenuButton(IDS_EDIT_MYITEM_1 + 1,NULL,-1,_T("&MyItem 2")),iIndex+3);
}
}
return TRUE;
}

<ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <ExecutablePath>D:\WinDDK\7600163851\bin\x86;$(ExecutablePath)</ExecutablePath> </PropertyGroup> <PropertyGroup> <IncludePath>D:\WinDDK\7600163851\inc\api;D:\WinDDK\7600163851\inc\ddk;D:\WinDDK\7600163851\inc\crt;$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup> <LibraryPath>D:\WinDDK\7600163851\lib\win7\i386;$(LibraryPath)</LibraryPath> <TargetExt>sys</TargetExt> <LinkIncremental>false</LinkIncremental> <GenerateManifest>false</GenerateManifest> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>_X86_;DBG</PreprocessorDefinitions> <CallingConvention>StdCall</CallingConvention> <ExceptionHandling>false</ExceptionHandling> <BasicRuntimeChecks>Default</BasicRuntimeChecks> <BufferSecurityCheck>false</BufferSecurityCheck> <CompileAs>Default</CompileAs> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <AdditionalDependencies>ntoskrnllib;wdmlib;wdmseclib;wmiliblib;ndislib;Hallib;MSVCRTLIB;LIBCMTLIB;%(AdditionalDependencies)</AdditionalDependencies> </Link> <Link> <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> <EnableUAC>false</EnableUAC> <SubSystem>Native</SubSystem> <EntryPointSymbol>DriverEntry</EntryPointSymbol> <BaseAddress>0x10000</BaseAddress> <RandomizedBaseAddress> </RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> <GenerateDebugInformation>true</GenerateDebugInformation> <Driver>Driver</Driver> </Link> </ItemDefinitionGroup> <ItemGroup /> </Project> 保存文件,关闭VS2010,重新打开VS2010即可。 PS:配置文件生成后,以后新建工程时可以直接使用,在第四部中就不需要新建一个配置文件,直接添加生成的配置文件即可

QT/QML添加程序图标的方法

使用QT/QML实现的程序需要加入app图标的方法:

1 制作ICON格式图标,其他格式的可以通过ICON转换工具转换;

2 项目文件加入(pro) RC_ICONS = appico, appico就是app图标的名字;

3 qmake->重新构建->运行。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12620726.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存