大家帮帮忙!关于Resource的问题

harry1026 2003-04-03 05:26:00
我是用于实现窗口最小化时隐藏窗口,在任务栏显示图标。但是我易用notifyICON它就出现异常。甚至我设置form的ICON 为一个图标也会出现
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
其中ni是一个notifyIcon
this.ni.Icon = ((System.Drawing.Icon)(resources.GetObject("ni.Icon")));
系统提示说没法找到resource。但是在另外一个程序中却不会出现这种情况。
...全文
101 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
harry1026 2003-04-04
  • 打赏
  • 举报
回复
大家帮忙了:(
this.ni.Icon = ((System.Drawing.Icon)(resources.GetObject("ni.Icon")));
其中ni是一个notifyIcon。每次执行的时候在initializeComponet()的时候就会在这一句上出现异常,异常为
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Monitor.resources" was correctly embedded or linked into assembly "WinMonitor".
baseName: Monitor locationInfo: WinMonitor.Monitor resource file name: Monitor.resources assembly: WinMonitor, Version=1.0.1189.17543, Culture=neutral, PublicKeyToken=null

我怎样才能将icon链到这个resource中去??
harry1026 2003-04-03
  • 打赏
  • 举报
回复
但是,我在另外一个程序中执行就不会有问题了阿
Knight94 2003-04-03
  • 打赏
  • 举报
回复
我也遇到这种问题,
“this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));”是你设计窗口时,系统给你加上的,但“"$this.Icon"”在运行时是有问题的,你需要把它改为完全路径就行了,例如“this.Icon = ((System.Drawing.Icon)(resources.GetObject(@"c:\icon\myico.ico")));”

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧