有谁有即按Item里的Data又按Item.Caption排序的ListView的原代码,可送吗?(TListView)(5分)

  • 主题发起人 主题发起人 诸葛不才
  • 开始时间 开始时间

诸葛不才

Unregistered / Unconfirmed
GUEST, unregistred user!
有谁有即按Item里的Data又按Item.Caption排序的ListView的原代码,可送吗?(TListView)
如果没有,普通的也行,自已看帮助看不太懂,谢了,没钱了!!!
 
**** 标准ListView就可以,
SortType设为stBoth
 
以下代码有什么错误啊:(BCB)
AnsiString Data1,Data2;
if (ColumnsClick)
{
Data1 = PMyData(Item1->Data)->NType;
Data2 = PMyData(Item2->Data)->NType;
if (ColumnIndex == 0)
{

if (Status[ColumnIndex])
{
Compare = CompareText(Data1,Data2);
Compare = CompareText(Item1->Caption,Item2->Caption);
ListView1->Columns->Items[0]->ImageIndex = 2;
ListView1->Columns->Items[1]->ImageIndex = -1;
ListView1->Columns->Items[2]->ImageIndex = -1;
ListView1->Columns->Items[3]->ImageIndex = -1;
Status[ColumnIndex] = false;
}
else
{
Compare = CompareText(Data2,Data1);
Compare = CompareText(Item2->Caption,Item1->Caption);
ListView1->Columns->Items[0]->ImageIndex = 3;
ListView1->Columns->Items[1]->ImageIndex = -1;
ListView1->Columns->Items[2]->ImageIndex = -1;
ListView1->Columns->Items[3]->ImageIndex = -1;
Status[ColumnIndex] = true;
}
}
else
{
if (Status[ColumnIndex])
{
Compare = CompareText(Data1,Data2);
Compare = CompareText(Item1->Caption,Item2->Caption);
Status[ColumnIndex] = false;
for (int x = 0;x < ListView1->Columns->Count; x++)
{
if (x != ColumnIndex)
ListView1->Columns->Items[x]->ImageIndex = -1;
else
ListView1->Columns->Items[x]->ImageIndex = 2;
}
}
else
{
Compare = CompareText(Data2,Data1);
Compare = CompareText(Item2->Caption,Item1->Caption);
Status[ColumnIndex] = true;
for (int x = 0; x<ListView1->Columns->Count; x++)
{
if (x != ColumnIndex)
ListView1->Columns->Items[x]->ImageIndex = -1;
else
ListView1->Columns->Items[x]->ImageIndex = 3;
}
}
}
ColumnsClick = false;
}

以上代码为在ListView1Compare事件中,可以为Compare两次赋值吗?但我一次两次
效果的确不一样,有人有原码吗?
该怎样,能详细点吗?
 
以上代码有错,我懂了,谢了
 
同志们,还是不行,Data是做什么用的,比如我想把部门始终是在第一位,然后再人员
该怎样做啊,就像WinExploro,急啊!!!
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部