简体   繁体   English

C#从WebClient调整图像大小

[英]C# Resize image from webclient

I have a program that sets the image from a link , to a picture box. 我有一个程序,可以将图像从link设置为图片框。

For example: 例如:

pictureBox1.Load(" http://www.e357.net/wordpress/beingernest/wp-content/uploads/2010/07/questionmark-150x150.jpg "); pictureBox1.Load(“ http://www.e357.net/wordpress/beingernest/wp-content/uploads/2010/07/questionmark-150x150.jpg ”);

But since the pictureBox size is 100x100, the image gets cut down. 但是由于pictureBox的大小为100x100,因此图像会被缩小。

How can i resize the image, without changing the pictureBox size? 如何在不更改pictureBox大小的情况下调整图像大小?

Im using WinForms. 我正在使用WinForms。

Thanks. 谢谢。

You can just change your pictureBox1.SizeMode to achieve that behavior. 您可以只更改pictureBox1.SizeMode以实现该行为。

In your case 就你而言

pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;

and

pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

should work. 应该管用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM