2017-07-03 84 views

回答

0

你應該假的自動調整,然後設置高度,工具條和Toolstripcontrol 的寬度對於例如:

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; 

這樣的...

+0

但是內部控件在運行時增加用戶選擇 – user6001037

+0

user6001037請發佈您的代碼.. – santhosh

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); 
+0

問題是mainFiltersControl在運行時增長,但tooltrip仍保持相同大小 – user6001037

相關問題