Layout problem

You need to use the Anchor properties of your controls. Get the controls sized and positioned correctly on the form at the default size. You'd then set the Anchor of the TextBox and Button to Top & Left, the Anchor of the ListBox to Top & Left & Bottom and the Anchor of the PictureBox to all four sides.
 
Please attach your images directly to your post rather than providing links to external sites. It's easier for you and it's easier for us.

You should set the Location of the PictureBox to (0,0) and the SizeMode to AutoSize. You then set the AutoScroll property of the Panel to True.
 
Size of PictureBox Automatically Equal to Size of Panel when maximize or minimize

Hi! It works well !!!
Is there any code to detect whether we click maximize (minimize) button or not ?
That is I want to make the dimension of PictureBox always equal to Panel in these case.
Could I do it ?
Thanks !!!
 
Hi! It works well !!!
Is there any code to detect whether we click maximize (minimize) button or not ?
That is I want to make the dimension of PictureBox always equal to Panel in these case.
Could I do it ?
Thanks !!!
Why should you care whether the user maximises or minimises the form? I've already pointed out that if you set the Anchor property of a control it will resize automatically when its container resizes. If you want the PictureBox to always be the same size as its container then you should set its Dock property to Fill instead, which specifically makes a control fill its container.

That said, if you're trying to use a PictureBox inside a Panel as a way to be able to scroll around a large image in a small area then the size of the Panel should have no effect on the size of the PictureBox whatsoever. That's the whole point. The size of the PictureBox is controlled by the image it displays, not the container it's in.
 
Back
Top