我尝试了几件事,最终只是将图像直接放在 C:\Users\Gebruiker\Documents\Visual Studio 2012\Projects\FolderMonitor\FolderMonitor\bin\Debug 中。这目前有效,但理想情况下,我想将 notifyIcon.Icon = new Icon("folder.ico") 设置为解决方案中图像文件夹内的图像。但我无法弄清楚这是如何工作的..
public FolderMonitorApplicationContext()
{
this.monitor = new Monitor();
notifyIcon = new NotifyIcon();
notifyIcon.Icon = new Icon("folder.ico");
notifyIcon.Text = "Folder Monitor";
notifyIcon.Visible = true;
contextMenu = new ContextMenuStrip();
openMonitor = new ToolStripMenuItem();
exitApplication = new ToolStripMenuItem();
notifyIcon.ContextMenuStrip = contextMenu;
notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
openMonitor.Text = "Open";
openMonitor.Click += new EventHandler(OpenMonitor_Click);
contextMenu.Items.Add(openMonitor);
exitApplication.Text = "Exit..";
exitApplication.Click += new EventHandler(ExitApplication_Click);
contextMenu.Items.Add(exitApplication);
}
所以它目前正在工作,但不是我希望它如何工作。希望你能在这里帮助我,在此先感谢。