将图标放在标题栏中 [英] placing the icon in the titlebar

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

问题描述



通常,在VC ++ MFC应用程序向导中,标题栏将是带有MFC图标的项目名称.
我想在我的应用程序中用我的公司徽标替换该默认MFC图标.

任何人都可以帮助我做到这一点.


感谢u

Hi,

Normally in VC++ MFC application Wizard the title bar will be the project name comes along with MFC icon.
I want to replace that Default MFC icon with my company logo in my application.

Can any one help me in doing this.


Thank u

推荐答案

HICON hicon;
hicon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MYICON));
SetIcon(hicon, true );



不要忘记通过资源添加新图标 IDR_MYICON .
如果它是基于对话框的MFC应用程序,请在您的OnInitDialog()中进行操作
如果SDI应用程序在CMainFrame :: OnCreate()函数中执行此操作



dont forget to add the new icon IDR_MYICON via resource.
if it is a dialog based MFC application do it in your OnInitDialog()
if SDI application do it in your CMainFrame::OnCreate() function


检查 ^ ].
示例 [
Check SetClassLong [^].
Sample[^]


除了上述解决方案外,如果您使用向导生成项目,则有一个间接方法.转到您的项目文件夹和res文件夹并替换默认图标(使用向导生成的默认图标通常为< projectname> ; .icon)与您的图标.再次重建项目.但是此方法不会帮助您理解框架.
Along with above solutions, if you generate the project with the wizard then there is one indirect method.Go to your project folder and res folder and replace the default icon(generated with wizard normally it will be <projectname>.icon ) with your icon.rebuild the project again.But this method wont help you to understand the framework.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆