优化toolStrip布局设置:调整高度限制、添加CanOverflow=false以确保按钮正确换行显示
This commit is contained in:
@@ -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, 150); // 增加最小高度以允许按钮换行显示
|
this.toolStripContainer.TopToolStripPanel.MinimumSize = new System.Drawing.Size(0, 70); // 调整最小高度以容纳两行按钮
|
||||||
//
|
//
|
||||||
// dataGridViewTempDiff
|
// dataGridViewTempDiff
|
||||||
//
|
//
|
||||||
@@ -139,6 +139,7 @@ namespace JoyD.Windows.CS
|
|||||||
// toolStrip
|
// toolStrip
|
||||||
//
|
//
|
||||||
this.toolStrip.AllowDrop = true;
|
this.toolStrip.AllowDrop = true;
|
||||||
|
this.toolStrip.CanOverflow = false; // 禁止溢出到下拉菜单,强制在容器内换行
|
||||||
this.toolStrip.Dock = System.Windows.Forms.DockStyle.None;
|
this.toolStrip.Dock = System.Windows.Forms.DockStyle.None;
|
||||||
this.toolStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
this.toolStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@@ -157,11 +158,11 @@ namespace JoyD.Windows.CS
|
|||||||
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, 300); // 宽度设为0表示无限制
|
this.toolStrip.MaximumSize = new System.Drawing.Size(0, 60); // 降低最大高度以更明确控制
|
||||||
this.toolStrip.MinimumSize = new System.Drawing.Size(150, 25);
|
this.toolStrip.MinimumSize = new System.Drawing.Size(100, 25);
|
||||||
this.toolStrip.Name = "toolStrip";
|
this.toolStrip.Name = "toolStrip";
|
||||||
// 移除固定宽度设置,让toolStrip能根据容器自动调整宽度
|
// 移除固定尺寸设置,完全由容器控制大小
|
||||||
this.toolStrip.Size = new System.Drawing.Size(0, 30);
|
this.toolStrip.Size = new System.Drawing.Size(0, 25);
|
||||||
this.toolStrip.TabIndex = 3;
|
this.toolStrip.TabIndex = 3;
|
||||||
this.toolStrip.Text = "工具条";
|
this.toolStrip.Text = "工具条";
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user