更改对话框的图标

发布于 2024-10-04 16:27:16 字数 208 浏览 0 评论 0原文

我最近正在使用 Visual C++ 2010 编辑一个开源项目,我对 VC++ 不太了解,(我在 C++ 方面只有 5 天的经验),凭借我的一点知识,我正在更改该项目的一些用户界面,

只有我的项目中的一个图标,应用程序将主图标显示为图标,同时我想让该图标也出现在对话框的标题上(单击主窗体中的按钮时将显示该对话框),

该对话框已经在资源/对话框中,但我想更改它的图标;

i am recently editing an open source project in visual c++ 2010 , i don't know much about vc++ ,(i have only 5 days of experience in c++), with my little knowledge i am changing some user interface of the project

there is only one icon in my project ,the apps shows the main icon as icon , at the same time i want to make that icon to be on the title of a dialog also (the dialog will be shown when a button in main form is clicked),

the dialog is already in the resources/dialogs but i want to change the icon of it ;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒废 2024-10-11 16:27:16

您需要找到您感兴趣的对话框的对话框过程,并在 WM_INITDIALOG 消息处理程序中(如果尚不存在,则需要添加它)使用 WM_SETICON 设置图标:

// hIcon is your icon handle
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);

You need to find the dialog procedure of the dialog you're interested in, and in the WM_INITDIALOG message handler (you need to add it if it's not already present) use WM_SETICON to set the icon:

// hIcon is your icon handle
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文