2017-06-21 56 views

回答

-1

只需添加一個函數來將面板大小調整爲表格上的Resize事件即可。對於兩個面板,您只需要在表單的初始化函數中添加這樣的內容來處理調整大小。 (使用C#)

//To find to width of each panel, subtract 30 (or so, but your panels need to leave a little 
//space) from the width of the form, and then divide by number of panels. 

//Initialize the panel widths (If they aren't correct already) 
statusBarPanel1.Width = statusBarPanel2.Width = (Width - 30)/2; 

//Make the panel widths update if the form is resized 
Resize += (s, e) => statusBarPanel1.Width = statusBarPanel2.Width = (Width - 30)/2; 

面板的順序不應該改變,所以你不必擔心。

+0

我試過你的建議,通過手動設置面板寬度在窗體構造函數和表單加載事件,都不起作用。 – Graviton

+0

它適用於我的測試。你也在Form Resize事件中設置寬度,對吧? –