以编程方式更改程序图标 [英] Programmatically change the program icon

查看:68
本文介绍了以编程方式更改程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在VS 2010/C#上进行开发.

I'm developing on VS 2010/ C#.

有人知道如何以编程方式更改软件图标吗?

Does any one know how to change the software icon programmatically?

我实际上希望我的软件在同一软件安装中的Windows 7下具有一个图标,而对于Windows XP则具有另一个图标.

I actually want my software to have one icon under Windows 7 and another for Windows XP in the same software installation.

推荐答案

如果它是winform应用程序,则可以在主表单的formload事件中编写以下代码.

If it's a winform app, you can write below code in the formload event of the main form.

使用此链接找到操作系统: http://andrewensley.com/2009/06/c- detect-windows-os-part-1/

Use this link to find operating system : http://andrewensley.com/2009/06/c-detect-windows-os-part-1/

,然后在下面的代码中设置图标.

and then write below code to set icon.

private void InvestorReportingFormLoad(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.coins;            
        }

这篇关于以编程方式更改程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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