修改toolStrip布局为Flow并设置控件间距,确保空间不足时允许按钮多行显示,同时保证lblRegionNumber和txtRegionNumber在同一行
This commit is contained in:
@@ -208,12 +208,16 @@ namespace JoyD.Windows.CS
|
||||
// 使用Padding属性调整文本垂直位置,实现垂直居中效果
|
||||
this.lblRegionNumber.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0);
|
||||
this.lblRegionNumber.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
|
||||
// 设置Margin属性确保与txtRegionNumber紧密相连,避免被分割到不同行
|
||||
this.lblRegionNumber.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
|
||||
this.txtRegionNumber = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.txtRegionNumber.Name = "txtRegionNumber";
|
||||
this.txtRegionNumber.Size = new System.Drawing.Size(60, 25);
|
||||
this.txtRegionNumber.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtRegionNumber_KeyDown);
|
||||
this.txtRegionNumber.TextChanged += new System.EventHandler(this.TxtRegionNumber_TextChanged);
|
||||
// 设置Margin属性确保与lblRegionNumber紧密相连,避免被分割到不同行
|
||||
this.txtRegionNumber.Margin = new System.Windows.Forms.Padding(0, 2, 3, 2);
|
||||
//
|
||||
// toolStrip
|
||||
//
|
||||
@@ -246,12 +250,13 @@ namespace JoyD.Windows.CS
|
||||
this.btnNewTempDiff,
|
||||
this.btnLoadTempDiff,
|
||||
this.btnSaveTempDiff});
|
||||
// 使用HorizontalStackWithOverflow布局确保控件在同一行,空间不足时显示溢出按钮而非换行
|
||||
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||
// 使用Flow布局允许按钮多行显示
|
||||
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||
this.toolStrip.Location = new System.Drawing.Point(3, 0);
|
||||
this.toolStrip.MaximumSize = new System.Drawing.Size(0, 50);
|
||||
// 增加最大高度以允许多行显示
|
||||
this.toolStrip.MaximumSize = new System.Drawing.Size(0, 200);
|
||||
this.toolStrip.MinimumSize = new System.Drawing.Size(100, 50);
|
||||
// 设置AutoSize为true使工具栏能够自动调整大小
|
||||
// 保留AutoSize以确保良好显示
|
||||
this.toolStrip.AutoSize = true;
|
||||
this.toolStrip.Name = "toolStrip";
|
||||
this.toolStrip.Padding = new System.Windows.Forms.Padding(5);
|
||||
|
||||
Reference in New Issue
Block a user