【发布时间】:2016-03-20 16:00:39
【问题描述】:
如何让我的图片框相对于表单的大小调整它们的高度、宽度和位置?现在我的默认值是这样的:
但如果我用鼠标调整它的大小,它看起来像这样:
我怎样才能得到它,以便它正确且按比例(相对于表单的尺寸)填充空间?
这是我尝试过的:
private void Form1_Resize(object sender, EventArgs e) {
//adjust the size of the tiles relative to the dimension of the window
if (Size != new Size(442, 465)) {//the default size of the form
for (int i = 0; i < picBox.Length; i++) {
picBox[i].Height = Size.Height / 4;//picBox is an array of PictureBoxs with default heights, widths, and locations
picBox[i].Width = Size.Width / 4;
}
}
}
我的问题与this one 不同,因为我试图让我的内容适应表单的大小,而不是相反。
【问题讨论】:
标签: c# forms resize picturebox