Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Load file system icon at runtime C#

I have some C# code to get a icon from an embedded resource that works fine using a URI.

MyIcon = new System.Windows.Forms.NotifyIcon();
Stream iconStream = Application.GetResourceStream(
    new Uri("pack://application:,,,/uif/tiles/Interface.ico")).Stream;
MyIcon.Icon = new System.Drawing.Icon(iconStream);

I want to achieve the same but with a icon from the file system c:\red.ico

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this:

MyIcon.Icon = new System.Drawing.Icon("Your filepath");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading