I have a panel control with a picture box in it. How can I maintain the aspect ratio of the panel control when Resizing the form it’s on?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll need to store off the aspect ratio somehow, whether it’s something known to you at design time or if you just want to calculate it in the constructor of the form after
InitializeComponent(). In your form’sResizeevent, you’ll just need to set the size of the Panel to be the largest rectangle at that aspect ratio that fits within the ClientRectangle of the form.