C++Builder中ListView控件用法和示例总结整理
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// 切换ListView的显示风格为详细信息
ListView1->ViewStyle = vsReport;
// 清除ListView所有列和行的内容
ListView1->Columns->Clear();
ListView1->Items->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
// 添加第一列
TListColumn *lc = ListView1->Columns->Add();
lc->Caption = "第一列";
lc->Width = 120;
// 添加第二列
lc = ListView1->Columns->Add();
lc->Caption = "第二列";
lc->Width = 80;
// 添加第三列
lc = ListView1->Columns->Add();
lc->Caption = "第三列";
lc->Width = 100;
Application->ProcessMessages();
// 修改第二列的标题
ShowMess __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { // 切换ListView的显示风格为详细信息 ListView1->ViewStyle = vsReport; // 清除ListView所有列和行的内容 ListView1->Columns->Clear(); ListView1->Items->Clear(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { // 添加第一列 TListColumn *lc = ListView1->Columns->Add(); lc->Caption = "第一列"; lc->Width = 120; // 添加第二列 lc = ListView1->Columns->Add(); lc->Caption = "第二列"; lc->Width = 80; // 添加第三列 lc = ListView1->Columns->Add(); lc->Caption = "第三列"; lc->Width = 100; Application->ProcessMessages(); // 修改第二列的标题 ShowMess
下一篇:
MyBatis增删改查功能详解
