问题
how to Resizing the Windows form elements on resizing the form? is there any way to set the width of picturebox, panel, etc 100% like CSS? suggest me some help for best practices of layout? When i resize the Windows form, I want that Image size also change when i resize the image. like Windows Picture Viewer
回答1:
You would probably be okay with the Anchor property of the controls.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor(v=vs.71).aspx
回答2:
You should look into Control Docking, it'll probably suit your needs.
回答3:
What you may want is to set the properties of the image control to fill the image inside.
Steps:
- I created a new windows form
- I added a picture box to the form
- I set the picture box "Dock" property to "Fill"
- I added an image to the picture box
- I set the SizeMode property to "StretchImage" ("Zoom" might better fit your needs")
来源:https://stackoverflow.com/questions/8070139/resizing-the-form-elements-on-resizing-the-form