将winform得到的bitmap格式的普片转化成wpf image格式的图片
2011-06-15 16:17
363 查看
BitmapSource GetBitmapSource(Bitmap _bitmap) { Rectangle destRect = new Rectangle(0, 0, (int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight); var bitmap = new Bitmap((int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bitmap)) { g.DrawImage(_bitmap, destRect, destRect, GraphicsUnit.Pixel); } return Tobitmap(_bitmap); } BitmapSource Tobitmap(Bitmap bmp) { BitmapSource returnSource; try { returnSource = Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); } catch { returnSource = null; } return returnSource; }
相关文章推荐
- 解决WPF BitmapImage图片资源无法删除,文件正在被另一个进程使用
- WPF中使用BitmapImage处理图片文件
- WPF中使用BitmapImage处理图片文件
- WPF BitmapImage 图片资源无法删除,文件正在被另一个进程使用
- Android Bitmap保存为.bmp格式,图像转化为黑白图片
- Android Bitmap保存为.bmp格式,图像转化为黑白图片
- Obtaining Image Information on your own (得到图片格式)
- WPF中bitmapimage与byte[]格式相互转换
- Android Bitmap保存为.bmp格式,图像转化为黑白图片
- WPF BitmapImage 图片资源无法删除,文件正在被另一个进程使用
- Android base字符串转化为bitmap格式 再转成ImageView
- WPF中使用BitmapImage处理图片文件(转)
- WPF中的图片文件、byte[]、BitmapImage的操作
- WPF中使用BitmapImage处理图片文件 .
- Flex AIR 读取本地图片并得到读取图片的Bitmap对象
- C#之WinForm基础 图片查看器升级版(代码定格式),textbox定文件夹,用listbox、picturebox
- 得到ImageView的图片,压缩成PNG,并得到二进制流数据
- winform利用ImageList控件和ListView控件组合制作图片文件浏览器
- 选择本地图片并转化成bitmap
- Android中几种图像特效处理的小技巧,比如圆角,倒影,还有就是图片缩放,Drawable转化为Bitmap,Bitmap转化为Drawable等等