pictureEdit 实现图片的自适应大小


pictureEdit 可以直接绑定Image 或者 Byte Array (根据官方资料)

当我们在PictureEdit中放置一个较大图片的时候,SizeMode属性虽然设置Zoom 但还是会出现将图片容器趁的过大,从而影响下面的显示。

FileStream fs = new FileStream (fileName,FileModel.OpenOrCreate);

 

byte[] bt = new byte[fs.length];

fs.Close();

if(bt!=null)

{

Stream stream = new MemoryStream(bt);

Bitmap bmtemp = new Bitmap(stream);

Image img = new Bitmap(bmtemp, pictureEdid.With, pictureEdid.Height); //指定图片显示尺寸与控件大小一样

pictureEdid.EditValue = img;

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM