如何讓我的圖片框相對於表單的大小調整其高度,寬度和位置?現在,我已經默認這樣看:如何在表單大小更改時將PictureBoxs的高度,寬度和位置調整爲表單?
但如果我用我的鼠標調整其大小,它看起來像這樣:
我怎樣才能得到它,使其充滿在空間中是否正確和有效(與表單的尺寸有關)?
這是我曾嘗試:
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不同,因爲我試圖讓我的內容調整到形式,而不是周圍的其他方式的大小。
感謝您的答覆,但是當我嘗試,它甚至不會讓我改變大小... –
請參考這個,還有的WinForms的侷限性http://stackoverflow.com/questions/5962595 /如何調整大小 - 自動調整內容 - 自動調整內容 –
我也嘗試過,但沒有運氣。 –