The title of the question pretty much states the problem. Is it possible?
views:
1380answers:
3
+2
A:
We had this problem a couple of months back and we found this solution
http://www.dreamincode.net/code/snippet1684.htm
I'm sooo glad that we insert references in our comments to where we found something. I prefer sending this to you instead of my code because it's merge with a get multiple zipped file which complexify what you really want to get at.
Philippe Asselin
2009-08-26 20:26:08
This converts a System.Drawing.Image to a System.Drawing.Icon. I'm trying to convert a System.Windows.Control.Image to an System.Drawing.Icon.
Mark Schroering
2009-08-27 11:46:09
+2
A:
I modified an example from here. This seems to work pretty good.
public static Icon Convert(BitmapImage bitmapImage)
{
System.Drawing.Bitmap bitmap = null;
var width = bitmapImage.PixelWidth;
var height = bitmapImage.PixelHeight;
var stride = width * ((bitmapImage.Format.BitsPerPixel + 7) / 8);
var bits = new byte[height * stride];
bitmapImage.CopyPixels(bits, stride, 0);
unsafe
{
fixed (byte* pB = bits)
{
var ptr = new IntPtr(pB);
bitmap = new System.Drawing.Bitmap(width, height, stride,
System.Drawing.Imaging.PixelFormat.Format32bppPArgb,
ptr);
}
}
return Icon.FromHandle(bitmap.GetHicon());
}
Mark Schroering
2009-08-28 16:19:00
A:
how would you convert a system.drawing.image to a system.windows.controls.image? i need your help!!! =´(
virus
2010-04-09 16:24:42