提交当前代码变更
This commit is contained in:
@@ -2310,17 +2310,17 @@ namespace JoyD.Windows.CS
|
||||
|
||||
// 根据可见按钮数量和容器宽度计算需要的行数
|
||||
// 假设每个按钮和分隔符大约占用60像素宽度
|
||||
int buttonWidth = 60;
|
||||
int buttonWidth = 25;
|
||||
int buttonsPerRow = Math.Max(1, containerWidth / buttonWidth);
|
||||
int requiredRows = (int)Math.Ceiling((double)visibleButtonCount / buttonsPerRow);
|
||||
|
||||
// 设置TopToolStripPanel的最小高度,确保有足够空间显示多行按钮
|
||||
int buttonHeight = 35; // 按钮高度加上边距
|
||||
int buttonHeight = 25; // 按钮高度加上边距
|
||||
int requiredHeight = requiredRows * buttonHeight + 10; // 加上额外边距
|
||||
|
||||
// 限制最大高度,防止高度过大
|
||||
requiredHeight = Math.Min(requiredHeight, 200);
|
||||
|
||||
requiredHeight = Math.Max(requiredHeight, 35);
|
||||
toolStrip.MinimumSize = new Size(toolStrip.MinimumSize.Width, requiredHeight);
|
||||
// 设置TopToolStripPanel的最小高度
|
||||
toolStripContainer.TopToolStripPanel.MinimumSize = new Size(toolStripContainer.TopToolStripPanel.MinimumSize.Width, requiredHeight);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user