title: How can I load a program icon in C#
body: <p>I have a path of some program (for example explorer), how can I get program icon, convert it to png/jpeg and then display in PictureBox?</p>
  
  <p>I have something like this:</p>
  
  <pre><code>string filePath = "C:\\myfile.exe";
  Icon TheIcon = IconFromFilePath(filePath);
  if (TheIcon != null) {
  
   // But then I don't know what to do...
  
  }
  
  public Icon IconFromFilePath(string filePath){
   Icon programicon = null;
   try {
    programicon = Icon.ExtractAssociatedIcon(filePath);
   }
   catch { } 
   return programicon;
  }
  </code></pre>
  
  <p>I found something similar <a href="https://stackoverflow.com/questions/462270/get-file-icon-used-by-shell">here</a>. Here is the icon. How I can create 32-bit icon?</p>
  
  <p><img src="https://i.stack.imgur.com/be5sE.png" alt="256 colors"></p>