PictureBox不会更改其大小 [英] PictureBox does not change its size

查看:84
本文介绍了PictureBox不会更改其大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Form中有一个PictureBoxButton. PictureBox填充Form,并且SizeMode属性设置为StretchImage.

I have a PictureBox and a Button inside a Form. The PictureBox fill the Form and the SizeMode property is set to StretchImage.

当我单击按钮时,我想更改图像尺寸(更大),并且我还希望显示滚动条.

When i click the button I want to change the image size (bigger), and I want also that the scrollbars appear.

因此,我在点击事件上更改了PictureBoxSize属性:

So, I change the Size property of my PictureBox on the click event:

pictureBox1.Size = new Size(800, 800);

但此代码无效.
为什么?

but this code does not have any effect.
Why?


我还尝试过使用GDI命令重绘图像本身,但是这种方式不会显示滚动条.


I also tried to redraw the image itself (using GDI commands), but in this way the scrollbars do not appear.


我怎么解决这个问题? 谢谢.


How can I solve this problem? Thanks.

推荐答案

设置:

pictureBox1.Bounds = this.ClientRectangle;
pictureBox1.Dock = DockStyle.None;

(对于PictureBox),您将能够调整PictureBox本身的大小.

for your PictureBox and you will be able to resize the PictureBox itself.

这篇关于PictureBox不会更改其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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