使用C#winform应用程序以编程方式设置应用程序图标。 [英] Application icon set programatically using C# winform application.
本文介绍了使用C#winform应用程序以编程方式设置应用程序图标。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置Windows图标属性?该图标也将用作任务栏中显示的图标。
我没有使用Icon Property设置应用程序图标。但我想以编程方式进行。当我将应用程序悬停在任务栏中时。它必须显示。
使用Windows表单C#应用程序。
我尝试过:
给我一个实现此任务的想法。
How to set the windows icon property? That icon will then be used as the icon shown in the taskbar as well.
I didn't set application Icon using Icon Property. But I want to do it in programmatically. When I hover the application in task bar. it has to display.
Using Windows form C# application.
What I have tried:
Give me an idea to achieve this task.
推荐答案
试试这个,例如在表单构造函数中:
Try this, e.g. in the form constructor:
public Form1()
{
InitializeComponent();
using (var stream = File.OpenRead("Test.ico"))
{
this.Icon = new Icon(stream);
}
}
以下是 Codeproject资源 [ ^ ]
这篇关于使用C#winform应用程序以编程方式设置应用程序图标。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文