从图像控件将图像保存到特定路径

编程入门 行业动态 更新时间:2024-10-26 12:27:24
本文介绍了从图像控件将图像保存到特定路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的朋友, 我想将图像保存到Image Control的特定路径.示例代码如下. XMLA代码 ----------

Dear Freinds, I want to save Image to particular path from Image Control. Sample coding are below. XMLA Code ----------

<Image Source="{Binding signat}" Canvas.Left="6" Canvas.Top="74" Height="423" x:Name="img_signature" Stretch="Fill" Width="573"> </Image>

CS代码 -------

Cs code -------

Binding b = new Binding(); b.Source = ds.Tables["tab_grdbindload"]; b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; b.Path = new PropertyPath("signat"); this.img_signature.SetBinding(Image.SourceProperty, b);

上面的编码用于从数据库加载图像. 现在,我想在特定路径中保存加载的图像. 预先感谢, Maha S.

The above coding used to loaded image from database. Now I want to save loaded image in particular path. Thanks in advance, Maha S.

推荐答案

我的解决方案在这里工作正常.. my solution is here its working fine.. var encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img_signature.Source)); using (FileStream stream = new FileStream(strpath + strfilename, FileMode.Create)) encoder.Save(stream);

更多推荐

从图像控件将图像保存到特定路径

本文发布于:2023-11-09 15:09:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   控件   路径

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!