2010-06-17 82 views
0
VariableBox = gcnew ListView(); 
VariableBox->Font = ScriptEditorOptions->FontSelection->Font; 
VariableBox->Dock = DockStyle::Fill; 
VariableBox->BorderStyle = BorderStyle::Fixed3D; 
VariableBox->BackColor = ScriptEditorOptions->BCDialog->Color; 
VariableBox->ForeColor = ScriptEditorOptions->FCDialog->Color; 
VariableBox->DoubleClick += gcnew EventHandler(this, &ScriptEditor::VariableBox_DoubleClick); 
VariableBox->View = View::Details; 
VariableBox->MultiSelect = false; 
VariableBox->CheckBoxes = false; 
VariableBox->FullRowSelect = true; 
VariableBox->HideSelection = false; 
VariableBox->Tag = (int)1; 

ColumnHeader^ VariableBoxName = gcnew ColumnHeader(); 
VariableBoxName->Text = "Variable Name"; 
VariableBoxName->Width = 70; 
ColumnHeader^ VariableBoxType = gcnew ColumnHeader(); 
VariableBoxType->Text = "Type"; 
VariableBoxType->Width = 50; 
ColumnHeader^ VariableBoxIndex = gcnew ColumnHeader(); 
VariableBoxIndex->Text = "Index"; 
VariableBoxIndex->Width = 50; 
VariableBox->Columns->Add(VariableBoxName); 
VariableBox->Columns->Add(VariableBoxType); 
VariableBox->Columns->Add(VariableBoxIndex); 
VariableBox->ColumnClick += gcnew ColumnClickEventHandler(this, &ScriptEditor::VariableBox_ColumnClick); 

我在WinForms應用程序中具有上述代碼。該控件直接添加到主窗體中。出於某種原因,當佈局設置爲時,它從不呈現任何項目或列。詳細信息 - 只有滾動條可見。下面的代碼是用來項添加到其收藏:列表視圖不在「詳細信息」視圖中呈現項目

ListViewItem^ Item = gcnew ListViewItem("Qw"); 
Item->SubItems->Add("Int"); 
Item->SubItems->Add("10"); 
VariableBox->Items->Add(Item); 

切換到任何其他視圖(無論是在運行時或設計時)修復該問題。任何想法爲什麼發生這種情況?

編輯:凹凸!或者是不允許的?

回答

0

原來我在顯示控件之前刪除了列標題。

相關問題