المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Using icons in Resources folder



C# Programming
07-07-2009, 02:50 PM
Hi

My solution is client/server and has a few projects in the solution, server, client and interfaces..

The namespace is ClientServerTimesheet.

In the Client project I have a Resources folder. I have added two icons, "Lamp Black Icon.ico" and "Lamp Red Icon.ico". Both setup to build as EmbeddedResource. I also have a number of forms in this project. They must all access the same icons.

If I use notifyIcon1.Icon = new Icon(GetType(), "Lamp Black Icon.ico"); in the form Office I get a runtime error that it can't find the icon in class ClientServerTimesheet.Office.

How do I write the code to access the icons from all the forms in the project without having to add the icons to each and every form?