如何在Silverlight中将图像转换为Byte

如何在Silverlight中将图像转换为Byte

本文介绍了如何在Silverlight中将图像转换为Byte []?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我应该在我的项目中读取类型为png的图像.我有一个名为"Images"的文件夹.我将图像放到该文件夹​​中.我可以读取此图像,但不能将其转换为字节[].

我有一个对象,该对象具有一个名为"Image"的属性,并且此属性的类型为byte [].我应该读取读取的图像并将该图像设置为对象的Image属性.在网上探索了很长时间后,我尝试了此方法.如何在 Silverlight 中将图像转换为byte []?我找不到能解决我问题的解决方案.

谢谢您的提前答复..

Hi,

I should read an image which type is png in my project. I have a folder named "Images". I put my image to this folder. I can read this image but can not convert it to byte [] .

I have an object which have a property named "Image" , and type of this property is byte[] . I should take the image which is read and set this image to my objects''s Image property. I tried this after exploring this issue a long time at net. How can ı convert the image to byte[] in Silverlight ? I couldn''t find a solution which can solve my problem.

Thanks for your replies in advance ..

推荐答案


string s1 = Environment.CurrentDirectory;
string s2 = Path.GetDirectoryName(Application.Current.ToString());
string s3= System.IO.Directory.GetCurrentDirectory();



但是所有这些代码块都显示了桌面"C:\ Users \ MyUser".

如何在Silverlight中获取projet目录?
感谢您的提前答复.



But all these code blocks shows the desktop "C:\Users\MyUser".

How can I take the projet directory in silverlight ?
Thanks for the replies in advance..


这篇关于如何在Silverlight中将图像转换为Byte []?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:44