C#设计的程序如何更改应用程序的图标
答案:2 悬赏:30
解决时间 2021-03-02 10:48
- 提问者网友:白柏唇蜜
- 2021-03-01 16:32
不知道该怎么改,注意!是应用程序的图标,不是窗体的图标,谢谢哈
最佳答案
- 二级知识专家网友:萌萌哒小可爱
- 2021-03-01 16:38
1.当“解决方案资源管理器”中有项目选中时,在“项目”菜单上单击“属性”。
2.选择“应用程序”窗格。
3.从“图标”下拉列表中选择图标 (.ico) 文件。
2.选择“应用程序”窗格。
3.从“图标”下拉列表中选择图标 (.ico) 文件。
全部回答
- 1楼网友:一场云烟
- 2021-03-01 17:02
获取图标: using system; using system.runtime.interopservices; using system.drawing; namespace windowsapptmp { public class extracticon { [dllimport("shell32.dll")] private static extern int shgetfileinfo ( string pszpath, uint dwfileattributes, out shfileinfo psfi, uint cbfileinfo, shgfi uflags ); [structlayout(layoutkind.sequential)] private struct shfileinfo { public shfileinfo(bool b) { hicon=intptr.zero;iicon=0;dwattributes=0;szdisplayname="";sztypename=""; } public intptr hicon; public int iicon; public uint dwattributes; [marshalas(unmanagedtype.lpstr, sizeconst=260)] public string szdisplayname; [marshalas(unmanagedtype.lpstr, sizeconst=80)] public string sztypename; }; private extracticon() { } private enum shgfi { smallicon = 0x00000001, largeicon = 0x00000000, icon = 0x00000100, displayname = 0x00000200, typename = 0x00000400, sysiconindex = 0x00004000, usefileattributes = 0x00000010 } public static icon geticon(string strpath, bool bsmall) { shfileinfo info = new shfileinfo(true); int cbfileinfo = marshal.sizeof(info); shgfi flags; if (bsmall) flags = shgfi.icon|shgfi.smallicon|shgfi.usefileattributes; else flags = shgfi.icon|shgfi.largeicon|shgfi.usefileattributes; shgetfileinfo(strpath, 256, out info,(uint)cbfileinfo, flags); return icon.fromhandle(info.hicon); } }
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯