关于列表的创建.. - C++ Builder / Windows SDK/API
图中的列表是如何创建的...
只会editbox...
跪求各位前辈给个简单的例子..
谢谢
[解决办法]
是个listview
弄个lisitview控件到窗体上,设置viewstyle为vsreport就可以了
void __fastcall TFaceEnCodeMainForm::InitFileListViewCo( bool Type){ TListColumn *ListCol; if(FileListView->Items->Count >0) { FileListView->Items->Clear(); } if(FileListView->Columns->Count > 0) { FileListView->Columns->Clear(); } MainStatusBar->Panels->Items[2]->Text ="总计:" +IntToStr(FileListView->Items->Count)+" 个文件"; if(!Type) { ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件名"; ListCol->Width = 200; ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件路径"; ListCol->Width = 400; ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件大小"; ListCol->Width = 100; ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件类型"; ListCol->Width = 100; }else { ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件名"; ListCol->Width = 200; ListCol = FileListView->Columns->Add(); ListCol->Caption = "原始路径"; ListCol->Width = 400; ListCol = FileListView->Columns->Add(); ListCol->Caption = "原始大小"; ListCol->Width = 100; ListCol = FileListView->Columns->Add(); ListCol->Caption = "加密后大小"; ListCol->Width = 100; ListCol = FileListView->Columns->Add(); ListCol->Caption = "文件类型"; ListCol->Width = 100; ListCol = FileListView->Columns->Add(); ListCol->Caption = "CRC32"; ListCol->Width = 100; }}//---------------------------------------
[解决办法]
This example requires only a blank form. All other objects: TListView, TListColumns, TListItems, are created dynamically. You must add #include <comctrls.hpp> to the top of the unit void __fastcall TForm1::FormCreate(TObject *Sender){ const char Names[6][2][10] = {{"Rubble","Barny"}, {"Michael", "Johnson"}, {"Bunny", "Bugs"}, {"Silver", "HiHo"}, {"Simpson", "Bart"}, {"Squirrel", "Rocky"}}; TListColumn *NewColumn; TListItem *ListItem; TListView *ListView = new TListView(this); ListView->Parent = this; ListView->Align = alClient; ListView->ViewStyle = vsReport; NewColumn = ListView->Columns->Add(); NewColumn->Caption = "Last"; NewColumn = ListView->Columns->Add(); NewColumn->Caption = "First"; for (int i = 0; i < 6; i++) { ListItem = ListView->Items->Add(); ListItem->Caption = Names[i][0]; ListItem->SubItems->Add(Names[i][1]); }}