Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Make a PictureBox Scrollable [duplicate]

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.

like image 384
unnamed Avatar asked May 24 '11 11:05

unnamed


2 Answers

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

like image 124
Kamyar Avatar answered Oct 02 '22 13:10

Kamyar


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

like image 39
SLaks Avatar answered Oct 02 '22 13:10

SLaks