converting images
-
How do you convert an image to an icon? I've tried a couple of things, the latest being statusBarPanel1.Icon = (Icon) (new ImageConverter.ConvertFrom(imageList1.Images[2])); Anyone have any success with this? Thanks. vaMope
It appears that you can't :(( I tried
new IconConverter().ConvertFrom(myBitmap);
and it throws a NotSupportedException with the text "IconConverter cannot convert from System.Drawing.Bitmap". James Sonork ID: 100.11138 - Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971 -
It appears that you can't :(( I tried
new IconConverter().ConvertFrom(myBitmap);
and it throws a NotSupportedException with the text "IconConverter cannot convert from System.Drawing.Bitmap". James Sonork ID: 100.11138 - Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971Thanks, James. I didn't get it to work that way, either, but I tried something else with better results. I set the build property of each image I wanted to reference to 'Embedded Resource' rather than 'Content'. Then, I used the following routine to grab the icon from the assembly. public static Icon GetIcon(string iconName) { Assembly assemb = Assembly.GetEntryAssembly(); return new Icon(assemb.GetManifestResourceStream("mynamespace.myfolder." + iconName)); } Note that the case must be correct and the file extension and folder name must be included. vaMope