为toolStrip添加MinimumSize和MaximumSize设置,强制控制Flow布局的换行行为

This commit is contained in:
zqm
2025-11-10 14:15:44 +08:00
parent f65a26cf1f
commit ca35eaa389

View File

@@ -206,6 +206,9 @@ namespace JoyD.Windows.CS
this.toolStrip.AllowDrop = true; this.toolStrip.AllowDrop = true;
this.toolStrip.AutoSize = true; this.toolStrip.AutoSize = true;
this.toolStrip.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip.Dock = System.Windows.Forms.DockStyle.None;
// 设置最小和最大大小帮助控制Flow布局的行为
this.toolStrip.MinimumSize = new System.Drawing.Size(150, 25);
this.toolStrip.MaximumSize = new System.Drawing.Size(150, 300);
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
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[] {