中易网

C#设计的程序如何更改应用程序的图标

答案:2  悬赏:30  
解决时间 2021-03-02 10:48
不知道该怎么改,注意!是应用程序的图标,不是窗体的图标,谢谢哈
最佳答案
1.当“解决方案资源管理器”中有项目选中时,在“项目”菜单上单击“属性”。
2.选择“应用程序”窗格。
3.从“图标”下拉列表中选择图标 (.ico) 文件。
全部回答
获取图标: 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); } }
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
dnf男气功用85ss楷臂
光谱学与光谱分析 请选择文件类型为 主文档是
福来家地板在哪里啊,我有事要去这个地方
为什么说乌克兰是俄罗斯的地缘政治支轴国家
车胎被扎钉子,拔下之后补车胎的师傅用水检测
初一上册语文春第四段应该用什么语气、语调去
我的购房发票能改名字吗
烟台开发区法院几点上班
豫东土菜馆我想知道这个在什么地方
59升到69要多少经验
《大秦帝国之崛起》叶阳后有历史原型吗 最后
为什么人们总是喜欢讨论别人的是非?
妈妈的手外加作文30字
采油农场地址在哪,我要去那里办事
银行卡没有开通网银,公司把钱打入我的卡里,
推荐资讯
我看“银河战士融合”最速通关中高手们的无限
中国·百老泉酒业有限公司珠海斗门白藤二路专
交通大街/解放路(路口)这个地址在什么地方,
那个朋友瞧得起
酉阳县民胜灯饰经营部地址在什么地方,想过去
星辰小超市地址有知道的么?有点事想过去
我家小布丁(布丁仓鼠)很爱咬我的手怎么回事
西华小超市在什么地方啊,我要过去处理事情
手游问道乐善施怎么过
14后面第三个数是几
中国农业银行迁安丰安分理处在哪里啊,我有事
幽美(环境)的反义词
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?