diff --git a/WindowsFormsApp6/MainForm.Designer.cs b/WindowsFormsApp6/MainForm.Designer.cs
index 16b43c8..cd1e6a7 100644
--- a/WindowsFormsApp6/MainForm.Designer.cs
+++ b/WindowsFormsApp6/MainForm.Designer.cs
@@ -356,7 +356,7 @@ namespace WindowsFormsApp6
this.buttonToggleLayout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonToggleLayout.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.buttonToggleLayout.ForeColor = System.Drawing.Color.White;
- this.buttonToggleLayout.Location = new System.Drawing.Point(197, 17);
+ this.buttonToggleLayout.Location = new System.Drawing.Point(447, 17);
this.buttonToggleLayout.Name = "buttonToggleLayout";
this.buttonToggleLayout.Size = new System.Drawing.Size(140, 40);
this.buttonToggleLayout.TabIndex = 4;
@@ -365,7 +365,7 @@ namespace WindowsFormsApp6
this.buttonToggleLayout.Visible = false;
this.buttonToggleLayout.Click += new System.EventHandler(this.ButtonToggleLayout_Click);
//
- // button5
+ // button5 (模拟数据 - 暂时隐藏)
//
this.button5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(89)))), ((int)(((byte)(182)))));
@@ -379,6 +379,7 @@ namespace WindowsFormsApp6
this.button5.TabIndex = 3;
this.button5.Text = "🎲 模拟数据";
this.button5.UseVisualStyleBackColor = false;
+ this.button5.Visible = false;
this.button5.Click += new System.EventHandler(this.Button5_Click);
//
// buttonExport
@@ -389,7 +390,7 @@ namespace WindowsFormsApp6
this.buttonExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonExport.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.buttonExport.ForeColor = System.Drawing.Color.White;
- this.buttonExport.Location = new System.Drawing.Point(677, 17);
+ this.buttonExport.Location = new System.Drawing.Point(607, 17);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(140, 40);
this.buttonExport.TabIndex = 1;
@@ -397,7 +398,7 @@ namespace WindowsFormsApp6
this.buttonExport.UseVisualStyleBackColor = false;
this.buttonExport.Click += new System.EventHandler(this.ButtonExport_Click);
//
- // buttonPrint
+ // buttonPrint (打印 - 暂时隐藏)
//
this.buttonPrint.Anchor = System.Windows.Forms.AnchorStyles.None;
this.buttonPrint.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(152)))), ((int)(((byte)(219)))));
@@ -411,6 +412,7 @@ namespace WindowsFormsApp6
this.buttonPrint.TabIndex = 0;
this.buttonPrint.Text = "🖨️ 打印";
this.buttonPrint.UseVisualStyleBackColor = false;
+ this.buttonPrint.Visible = false;
this.buttonPrint.Click += new System.EventHandler(this.ButtonPrint_Click);
//
// MainForm
diff --git a/WindowsFormsApp6/MainForm.cs b/WindowsFormsApp6/MainForm.cs
index f23c436..3fd2ff3 100644
--- a/WindowsFormsApp6/MainForm.cs
+++ b/WindowsFormsApp6/MainForm.cs
@@ -51,6 +51,10 @@ namespace WindowsFormsApp6
InitializeTimeUpdate();
InitializeSerialPortAndModbus();
CenterInfoControls();
+ CenterBottomButtons();
+
+ // 监听窗体大小变化以重新居中按钮
+ this.Resize += (s, e) => CenterBottomButtons();
}
private void InitializeTimeUpdate()
@@ -1540,6 +1544,40 @@ namespace WindowsFormsApp6
textBox8.Location = new Point(col4X + col4LabelWidth, y2);
}
+ ///
+ /// 动态居中底部按钮
+ ///
+ private void CenterBottomButtons()
+ {
+ // 收集所有可见的按钮
+ List