以下代码有什么错误啊:(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两次赋值吗?但我一次两次
效果的确不一样,有人有原码吗?
该怎样,能详细点吗?