我将带有内部控件的ToolStripControlHost添加到ToolStrip。当内部控件重新生成时,工具条不会增长,尽管工具条和ToolStripControlHost的AutoSize都是正确的。我将不胜感激任何帮助。
答案 0 :(得分:0)
你应该假设Autosize,然后设置Toolstrip和Toolstripcontrol的高度和宽度 对于Eg:
this.toolStrip1.AutoSize = false;
this.toolStripButton1.AutoSize = false;
this.toolStripButton2.AutoSize = false;
this.toolStripButton3.AutoSize = false;
this.toolStripButton1.Height = 20;
this.toolStripButton2.Height = 40;
this.toolStripButton3.Height = 60;
this.toolStrip1.Height = 65;
像这样......
答案 1 :(得分:0)
ToolStripSeparator toolStripSeparator = new ToolStripSeparator()
{
Alignment = ToolStripItemAlignment.Left,
Overflow = ToolStripItemOverflow.Never,
BackColor = Color.White
};
toolStrip1.Items.Add(toolStripSeparator);
ToolStripControlHost toolStripControl = new ToolStripControlHost(mainFiltersControl)
{
Alignment = ToolStripItemAlignment.Left,
Overflow = ToolStripIte`enter code here`mOverflow.Always,
BackColor = Color.White,
Dock = DockStyle.Fill
};
toolStrip1.Items.Add(toolStripControl);
ToolStripButton toolStripButton = new ToolStripButton(Messages.AdditionalFiltersTitle)
{
Alignment = ToolStripItemAlignment.Right,
Overflow = ToolStripItemOverflow.Never,
ToolTipText = Messages.AdditionalFiltersTooltipDisabled,
BackCol`enter code here`or = Color.White
};
toolStripButton.Click += additionalFiltersButton_Click;
toolStrip1.Items.Add(toolStripButton);