How can I get scrollbars on Picturebox

前端 未结 5 1645
星月不相逢
星月不相逢 2020-11-27 05:32

I have PictureBox picture.

I use:

picture.Size = bmp.Size;
picture.Image = bmp;

Let\'s say there are two integers

5条回答
  •  一个人的身影
    2020-11-27 05:39

    I got it to work by also putting a picturebox inside a panel control, I set the Panel's AutoScroll property to true, but I also set the Panel's Autosize property to True, and the Panel's Dock property to Fill (that way when the user resizes the form - so will the Panel). For the Picturebox, I set it's Dock property to None, and the SizeMode to Autosize (so it resizes also when the Panel and form Resizes. It worked like a charm, the Picturebox has Scrollbars and when the user resizes the form - everything is still placed correctly!

提交回复
热议问题