Share via


Load Icon from file

Question

Saturday, March 11, 2006 5:12 PM

How do I set the Icon on the top bar to an exteranl .ico file?

All replies (5)

Saturday, March 11, 2006 9:04 PM âś…Answered | 1 vote

ok do this..

private void Form1_Load(object sender, EventArgs e)
{
          this.Icon = Icon.ExtractAssociatedIcon("file path to an exe or ico file");
}

remeber this static method of Icon class not only that gets the icon form lets say a .ico file.. but she can get you also the ico of an executabel

Have luck!!! If you dont manage to work it out tell us


Saturday, March 11, 2006 8:02 PM

you want do it programaticly?? or just import into your project?? and use from there??

the second one is simple so i will asume that your question is the first one

  1. open the icon file
  2. read all
    3)convert to icon object
  3. set the From1.icon=theIconYouImported

tell us if you manege it to wok.. if not .. provide some more of what you want to do.. and i will post some code Luck!


Saturday, March 11, 2006 8:25 PM

I want to do it programiticly.


Friday, August 22, 2008 5:24 PM

How do you get the icon if you have paths like this: "somedllfile.dll,0" or "anotherfile.exe,3"?


Friday, August 22, 2008 5:34 PM

Nevermind that question, I'll put it into another topic/question.