int m_nDataColSort=0;
bool IsAsc=true;
void __fastcall TForm1::RzListView4Compare(TObject *Sender, TListItem *Item1, TListItem *Item2,
int Data, int &Compare)
{
if(m_nDataColSort==0)
{
//按列表第二列排序
//Compare=CompareText(Item1->SubItems->Strings[0] ,Item2->SubItems->Strings[0] );
//按列表第一列排序
Compare=CompareText(Item1->Caption ,Item2->Caption );
}
}
//导入文件夹
void __fastcall TForm1::BitBtn29Click(TObject *Sender)
{
AnsiString Dir = "";
AnsiString CGstr;
if (!FolderDialog1->Execute()) return;
Dir =FolderDialog1->Directory;
//
int Trnum=0;
TSearchRec sr;
int iAttributes=0x0000003F;
int Oldlist;
if(FindFirst(Dir+"\\*.*",faDirectory,sr) == 0)
{
Oldlist = RzListView4->Items->Count;
do
{
if( !sr.Name.Pos(".") ) //sr.Name!="." && sr.Name!=".."
{
TListItem *pItem=0;
pItem=RzListView4->Items->Add();
//列表第一列,取出文件夹名进行格式化成字母格式"000"
if( sr.Name.Length()==1)
pItem->Caption="00"+sr.Name;
else if( sr.Name.Length()==2)
pItem->Caption="0"+sr.Name;
else
pItem->Caption=sr.Name; //AnsiString().sprintf("%03d",Oldlist+1); // ;
pItem->SubItems->Add(Dir+"\\"+sr.Name);
//pItem->SubItems->Add("***");
// if(CheckBox26->Checked)
// pItem->SubItems->Add(RightStr(AnsiString(sr.Name),3));
// else
// pItem->SubItems->Add("***");
//
// Ttree->Add(Dir+"\\"+sr.Name);
//Trnum+=1;
Oldlist++;
}
} while(FindNext(sr) == 0);
FindClose(sr);
}
//文件夹名排序
m_nDataColSort=0;
IsAsc=false;
RzListView4->AlphaSort();
RzListView4->Column[0]->Caption="序号[ 共"+AnsiString(Oldlist)+" ]" ;
}