增加高度限制并优化布局:移除Size设置、增加内边距确保toolStrip能显示两行按钮

This commit is contained in:
zqm
2025-11-10 14:47:26 +08:00
parent 70339db456
commit c8a49ec024

View File

@@ -123,7 +123,7 @@ namespace JoyD.Windows.CS
// toolStripContainer.TopToolStripPanel // toolStripContainer.TopToolStripPanel
// //
this.toolStripContainer.TopToolStripPanel.Controls.Add(this.toolStrip); this.toolStripContainer.TopToolStripPanel.Controls.Add(this.toolStrip);
this.toolStripContainer.TopToolStripPanel.MinimumSize = new System.Drawing.Size(0, 70); // 调整最小高度以容纳两行按钮 this.toolStripContainer.TopToolStripPanel.MinimumSize = new System.Drawing.Size(0, 100); // 大幅增加最小高度以确保有足够空间显示两行按钮
// //
// dataGridViewTempDiff // dataGridViewTempDiff
// //
@@ -155,14 +155,14 @@ namespace JoyD.Windows.CS
this.btnBrushSize10, this.btnBrushSize10,
this.btnBrushSize15, this.btnBrushSize15,
this.btnBrushSize25}); this.btnBrushSize25});
this.toolStrip.AutoSize = true; this.toolStrip.AutoSize = true; // 启用自动大小调整以适应多行按钮
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.toolStrip.Location = new System.Drawing.Point(3, 0); this.toolStrip.Location = new System.Drawing.Point(3, 0);
this.toolStrip.MaximumSize = new System.Drawing.Size(0, 60); // 降低最大高度以更明确控制 this.toolStrip.MaximumSize = new System.Drawing.Size(0, 100); // 增加最大高度以容纳两行按钮
this.toolStrip.MinimumSize = new System.Drawing.Size(100, 25); this.toolStrip.MinimumSize = new System.Drawing.Size(100, 50); // 增加最小高度确保初始显示有足够空间
this.toolStrip.Name = "toolStrip"; this.toolStrip.Name = "toolStrip";
// 移除固定尺寸设置,完全由容器控制大小 // 移除所有固定尺寸设置,完全由AutoSize控制
this.toolStrip.Size = new System.Drawing.Size(0, 25); this.toolStrip.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); // 增加内边距确保按钮有足够空间排列
this.toolStrip.TabIndex = 3; this.toolStrip.TabIndex = 3;
this.toolStrip.Text = "工具条"; this.toolStrip.Text = "工具条";
// //