问题描述
我想更改显示在框架左上角的默认图标.我尝试了许多方法-xpm,ico,bmp,按照建议SetIcon(wxIcon(wxT("icon.xpm"))); >这里.
我尝试了不同的图标尺寸,分别为16x16、24x24和32x32.
我还尝试在resource.rc文件中添加 MYICON1 ICON"Logo.ico"
,在resource.h文件中添加 #define MYICON1 101
和 SetIcon(wxIcon(MYICON1));
到框架构造函数..
顺便说一句,我正在Visual Studio 2010上使用wxwidgets 2.8
I want to change the default icon that shows up at the top left corner of the frame.I have tried many approaches- xpm, ico, bmp,using SetIcon(wxIcon(wxT("icon.xpm")));
as suggested here.
I tried different icon sizes, 16x16, 24x24 and 32x32.
I've also tried adding MYICON1 ICON "Logo.ico"
in the resource.rc file, #define MYICON1 101
in the resource.h file and SetIcon(wxIcon(MYICON1));
to the frame constructor..
btw, i'm using wxwidgets 2.8 on visual studio 2010
使用这种方法,在wxIcon(int)构造函数中出现错误.
With this approach, I get an error in the wxIcon(int) constructor..
PS,xsframe是我的主框架.我正在尝试更改其图标.
PS, xsframe is my main frame. whose icon i'm trying to change.
推荐答案
我引用了此处:
appicon ICON "myapp.ico"
#include "wx/msw/wx.rc"
请注意,此图标必须是.rc文件中的第一个图标,并且当您按字母顺序对图标进行排序时,必须是第一个.这是因为MS开发人员无法考虑如何确定应用程序的图标:它是Windows 9x下.rc文件中的第一个图标在NT下按字母顺序排列第一个(反之亦然).
Note that this icon must be the first icon in your .rc file and it must be the first one when you sort your icons alphabetically. This is because MS developers weren't able to make their mind on how to determine app's icon: it is the first one in .rc file under Windows 9x and the alphabetically first one under NT (or vice versa).
大多数人通常会错过这一点.希望能解决问题.
Most people usually miss this. Hope that fixes things.
这篇关于wxWidgets标题栏图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!