|
|
|
@ -59,6 +59,8 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500); |
|
|
|
this.FormClosing += SegmentProductionAutoForm_FormClosing; |
|
|
|
this.Load += Form1_Load; |
|
|
|
this.Resize += SegmentProductionAutoForm_Resize; // 新增Resize事件
|
|
|
|
|
|
|
|
workUnitSelect.SelectedIndexChanged += delegate |
|
|
|
{ |
|
|
|
if (workUnitSelect.SelectedValue == null) |
|
|
|
@ -91,14 +93,26 @@ namespace ButcherFactory.SegmentProductionAuto_ |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
// 窗体大小变化时,刷新flowlayout布局,保证滚动区域生效
|
|
|
|
private void SegmentProductionAutoForm_Resize(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
if (_isFormClosing || this.IsDisposed) return; |
|
|
|
|
|
|
|
// 强制刷新布局,解决低分辨率下FlowLayoutPanel不重绘、滚动失效
|
|
|
|
flowLayoutPanel1.PerformLayout(); |
|
|
|
flowLayoutPanel2.PerformLayout(); |
|
|
|
flowLayoutPanel3.PerformLayout(); |
|
|
|
flowLayoutPanel4.PerformLayout(); |
|
|
|
} |
|
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
Rectangle workArea = Screen.PrimaryScreen.WorkingArea; |
|
|
|
// 取屏幕可用区域的82%,上限限制 1440, 810
|
|
|
|
int initW = Math.Min((int)(workArea.Width * 0.9), 1440); |
|
|
|
int initH = Math.Min((int)(workArea.Height * 0.9), 810); |
|
|
|
// 初始窗口使用屏幕工作区,不再上限死1440,810
|
|
|
|
int initW = (int)(workArea.Width * 0.95); |
|
|
|
int initH = (int)(workArea.Height * 0.95); |
|
|
|
this.ClientSize = new Size(initW, initH); |
|
|
|
this.MinimumSize = new Size(1000, 650); |
|
|
|
this.MinimumSize = new Size(1024, 680); // 设置最小窗口,防止缩太小布局乱掉
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|