分享

pictureEdit 实现图片的自适应大小

 qxy2215 2016-11-30

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;

}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多