如何从WPF中的图像控件获取图像 [英] How to get Image from the Image control in WPF

查看:516
本文介绍了如何从WPF中的图像控件获取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从WPF中的图像控件获取图像

例如. int i = 10;
表示变量i的值为10

How to get the Image from the Image Control in WPF

eg. int i =10 ;
means variable i has value 10

<Image x:Name="imageViewer" Source= SomePath>



现在是什么/如何以编程方式获取值或imageimageviewer?
请帮助我


感谢Christian Graus的回应
实际上,我想获取Image的内容并将其分配给其他变量.



now what is/how to get the value or image imageviewer programatically?
Please help me through this


Thanks Christian Graus for your response
Actually I want to fetch the content of Image and assign it to some other variable.

推荐答案

ImageSource sc = imageViewer.Source;

我不确定您的int i = 10的示例意味着什么,只是您要说要从Image控件中为图像分配变量,对吗?
ImageSource sc = imageViewer.Source;

I''m not sure what your example for int i = 10 means, except that you''re saying you want to assign a variable to the image from an Image control, is that right ?


这篇关于如何从WPF中的图像控件获取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆