2010-11-30 29 views
3

我有一個帶有各種組框,按鈕和標籤的visual basic 2010表單。我希望能夠最大化表格,但是當我這樣做時,控件會保持在他們所在的位置,並且不會隨窗體調整大小。我希望他們根據表格按比例調整大小。任何幫助,將不勝感激。如何縮放窗體上的控件以適合窗體的比例?

+0

無用戶界面看起來像那樣。但是你可以通過使用Anchor屬性來獲得它,並且錨定在底部和右側。 – 2010-11-30 23:11:29

+0

好的錨會爲一些東西的工作,但基本的左,右,頂部和底部不會足以做什麼即時消息試圖做 – slister 2010-12-01 00:01:40

回答

1

我真的結束了使用表格佈局面板來安排一切與屏幕大小成正比。如果您的控件佈置在網格中,則它工作得非常好。

2

您可以根據表單的大小來設置控件的位置和大小ResizeEnd或Resize事件。您需要確保它在表單最小化或非常小時不會崩潰。

1

讓Form1中的形式,

gb_check是一組框的形式裏面

Groupboxheight, location and width可以如下

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize 
      gb_chek.Height = (Me.Height * 30)/100 'what ever be the form height the group box's height is always 30% of the form size 
      gb_chek.Width = (Me.Width * 40)/100 'what ever be the form width the group box's width is always 40% of the form size 
      gb_chek.Location = New Point((Me.Width)/18, (Me.Height)/12)' set the location of the form relative to form size; 
End Sub 

如果你可以讓相對於窗體大小在組框中有相對於組框的大小設置控件

0

這是正確的方法!爲了對每個屏幕分辨率都有正確的顯示,請使用.net框架中提供的佈局!您不需要編輯任何保證金或以往任何內容。

0

昏暗RES作爲新的SizeF(Screen.PrimaryScreen.WorkingArea.Width/Me.Size.Width,Screen.PrimaryScreen.WorkingArea.Height/Me.Size.Height) Me.Scale(RES)