如何在不使用图片框的拉伸图像属性的情况下在C#Windows应用程序中使图像框中的图像适合? [英] How Do I Fit The Image In Picture Box In C# Windows Application Without Using Stretch Image Property Of Picture Box?

查看:79
本文介绍了如何在不使用图片框的拉伸图像属性的情况下在C#Windows应用程序中使图像框中的图像适合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用



ImageViewer1.Image = new Bitmap(dlg.FileName);

ImageViewer1.SizeMode = PictureBoxSizeMode.StretchImage;





使用上面的代码可以使用任何方法在图片框中显示图像吗?



dlg是打开文件对话框。

I am using

ImageViewer1.Image = new Bitmap(dlg.FileName);
ImageViewer1.SizeMode = PictureBoxSizeMode.StretchImage;


Can there is any method to fit the image in picture box witout using above code?

dlg is open file dialog.

推荐答案

阅读以下内容: C#Winforms Size PictureBox without Distortion [ ^ ]
Read the following : C# Winforms Size PictureBox Without Distortion[^]


除了解决方案1:



你可以伸展你想要的任何东西,但是你应该明白:当你重新取样图像时,你只有在缩小图像时才能获得良好的质量,或者只是略微放大。如果你大大扩展它,你会得到太难看的像素化图像。因此,拥有最大可用尺寸的原始图像并在需要时仅缩小它总是更好。



矢量图形更好,永远不会像素化并被处理所有现代系统都非常快,所以除了非常小的图像外,所有情况都比较喜欢。



-SA

这篇关于如何在不使用图片框的拉伸图像属性的情况下在C#Windows应用程序中使图像框中的图像适合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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