维持对调整大小的控制长宽比长宽、大小

由网友(情癌)分享简介:我有一个控制面板,在它的图片框。我怎样才能保持调整大小的形式,它是在当面板控制方面比?I have a panel control with a picture box in it. How can I maintain the aspect ratio of the panel control when Resiz...

我有一个控制面板,在它的图片框。我怎样才能保持调整大小的形式,它是在当面板控制方面比?

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?

推荐答案

您将需要存储关闭长宽比不知何故,无论是什么在设计时给你听,或者如果你只是想计算出它的构造函数在的InitializeComponent的形式()。在表单的调整时,你只需要设置面板​​的尺寸是在表单的ClientRectangle的夹缝之中的长宽比最大的矩形。

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's Resize event, 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.

阅读全文

相关推荐

最新文章