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".
- 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.
精彩评论