开发者

How to Make a PictureBox Scrollable [duplicate]

开发者 https://www.devze.com 2023-03-08 04:47 出处:网络
This question already has answers here: How can I get scrollbars on Picturebox 开发者_如何学Go(5 answers)
This question already has answers here: How can I get scrollbars on Picturebox 开发者_如何学Go (5 answers) Closed 5 years ago.

I've 2 buttons, 1 PictureBox and 1 Panel. PictureBox's inside of the Panel and Panel's AutoScroll property is set to "true". Also PictureBox Dock property is set to "Fill".

  1. Button draws a Rectangle into the pictureBox, 2. one makes it bigger whose size is bigger than the pictureBox itself. So, I need pictureBox to be scrollable.

How can I make it? Any example for this thread?

My Best Regards...

Important: Please don't give advise using existing files! I'm not using them.


Disclaimer: Not tested.
1- Set your panel's AutoScroll property to true:

this.panel1.AutoScroll = true;  

2- Set SizeMode property of your picturebox to AutoSize:

this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;  

That should do the trick.
If you still have problems, there are some workaround mentioned in the following pages:
http://forums.techarena.in/software-development/1305463.htm
http://www.eggheadcafe.com/community/aspnet/2/10020769/picturebox.aspx If you


To do that, you need to change the PictureBox's Dock to None, then set the size yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号