通过遍历排序获得. 示意如下 var I: Integer; sLst : tstringlist; begin mmo1.Clear; sLst := tstringlist.Create; try for I := 0 to actlst1.ActionCount - 1 do begin if sLst.IndexOf(actlst1.Actions[i].Category) < 0 then sLst.Add(actlst1.Actions[i].Category) end; sLst.Sort; mmo1.Lines.AddStrings(sLst); finally sLst.Free; end;
示意如下
var
I: Integer;
sLst : tstringlist;
begin
mmo1.Clear;
sLst := tstringlist.Create;
try
for I := 0 to actlst1.ActionCount - 1 do
begin
if sLst.IndexOf(actlst1.Actions[i].Category) < 0 then
sLst.Add(actlst1.Actions[i].Category)
end;
sLst.Sort;
mmo1.Lines.AddStrings(sLst);
finally
sLst.Free;
end;