I have a PictureBox
inside the Panel with picture box Dock = DockStyle.Fill
.
When I assign picture into the PictureBox
, picture is stretch horizontal to fit the space available and need a vertical scrollbar to scroll the image. I do not need of horizontal scrollbar in it.
Please do not make this question as duplicate.. I have clearly mentioned that I only need of vertical scrollbar with run time resizing option of the panel.
Note: Panel size may change at run time (so, obviously PictureBox
size too).
Please help me out.
This solution uses a simple resize method which you can call whenever it should update its size.
prerequisites:
Turn off the docking for the PictureBox
Set the AutoScroll property of the Panel to true
Resizing method: