请教个基础问题

bleachj8 2012-03-30 05:00:10
WPF的Image控件有个Source方法我想请教下,winform的PicturBox有什么方法能代替Image控件的Source方法那 如果没有有什么办法用其他类代替那, 我有个项目是把图像数据保存到 JpegBitmapEncoder的这个方法里 encoder.Frames.Add(BitmapFrame.Create(BitmapFrame.Create(image1.Source as BitmapSource))); WPF的Image的SOURCE方法就行,但是我想用winform实现 不知道怎么改 求指教



pictureBox1.ImageLocation.= BitmapSource.Create(data.Width, data.Height, 96, 96, PixelFormats.Bgr32, null, coloredFrame, data.Width * PixelFormats.Bgr32.BitsPerPixel / 8);
encoder.Frames.Add(BitmapFrame.Create(BitmapFrame.Create(pictureBox1.ImageLocation as BitmapSource)));
using (MemoryStream ms = new MemoryStream())
{

encoder.Save(ms);

}

这么写会抱错The type 'System.Windows.Freezable' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
...全文
185 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
bleachj8 2012-03-30
  • 打赏
  • 举报
回复
error CS0029: Cannot implicitly convert type 'System.Windows.Media.Imaging.BitmapSource' to 'string'

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧