Convert Pic file (jpg, bmp, etc) to Icon c#
Written by dbrook, January 29th, 2008
Pleease reference this thread:
http://www.thescripts.com/forum/thread596738.html
Size your Pic file to .5 x .5 inches. (for some reason this was necessary.)
You can use Microsoft Photo Editor or Photoshop for editing/cropping.
Here's the C# code:
this.Icon = Icon.FromHandle(new Bitmap(Bitmap.FromFile(YourFilePath_PIC)).GetHicon ());
Stream st = new FileStream(YourFilePath_ICO, FileMode.Create);
this.Icon.Save(st);
YourFilePath_PIC would be like @"c:\test\myimage.bmp"
YourFIlePath_ICO would be like @"c:\test\myimage.ico"
Hope this helps,
David
Last edited by RedSon : January 29th, 2008 at 08:52 PM.
Reason: URL
RedSon /
January 29th, 2008 08:52 PM
Sizing your pic is necessary to size it to a square, I believe.
|
|
|
|