auto sizable picture box

156 views Asked by At

I have a form which contains picture box.

How can I make the picture box grow relatively when the form is getting bigger or smaller? and will not stay in absolute size?

I want the size of the picture box to be relative to the form size. if the size of the picture box is 80% of the form so it will remain exactly the same when maximized.

I tried auto size property and it didn't work. maybe I did it wrong.

1

There are 1 answers

0
forgetaboutme On

You can do this on the PictureBox.SizeMode property.

myPictureBox.SizeMode = PictureBoxSizeMode.Zoom;

See this link for more information: https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode(v=vs.110).aspx