2012-04-27 43 views
2

用下面的代碼.....下拉大小設置不採取

ToolStripControlHost treeViewHost; 
    ToolStripDropDown dropDown; 
    public MyTreeViewCombo() 
    { 
     TreeView treeView = new TreeView(); 
     treeView.BorderStyle = BorderStyle.None; 
     treeViewHost = new ToolStripControlHost(treeView); 
     // create drop down and add it 
     dropDown = new ToolStripDropDown(); 
     dropDown.Items.Add(treeViewHost); 
    } 
    public TreeView TreeView 
    { 
     get { return treeViewHost.Control as TreeView; } 
    } 
    private void ShowDropDown() 
    { 
     if (dropDown != null) 
     { 
      dropDown.Height = DropDownHeight; 
      dropDown.Width = DropDownWidth; 
      treeViewHost.Width = DropDownWidth; 
      treeViewHost.Height = DropDownHeight; 
      dropDown.Show(this, 0, this.Height); 
     } 
    } 
    [...] 

不管是什麼dropDownHeight設置爲,它只會顯示一個小下拉(高度不發生變化)。

任何想法爲什麼會發生這種情況?

+0

你可以看看在Firebug中生成的HTML什麼的?也許你有一個CSS規則埋在某個地方? – kaveman 2012-04-27 19:20:03

+0

這是.NET胖客戶/贏的形式。 – ort11 2012-04-27 19:24:42

+0

愚蠢的評論,我很抱歉... – kaveman 2012-04-27 19:25:08

回答