【发布时间】:2010-10-10 07:02:29
【问题描述】:
我有一个 System.Windows.Forms.Form 并想在运行时更改 Form.Icon 以显示状态。我已经设法从项目资源中加载图标:
Type type = this.GetType();
System.Resources.ResourceManager resources =
new System.Resources.ResourceManager(type.Namespace + ".Properties.Resources", this.GetType().Assembly);
this.Icon = (System.Drawing.Icon)resources.GetObject(
type.Namespace + ".Icons." + statusText + ".ico");
但显示的图标始终保持不变(设计时图标)。我是否必须调用一种方法来告诉表单应用更改?我对 Form.Icon 的使用有什么问题吗?
【问题讨论】: