请问下面这段代码什么意思
procedure TfrmCreep.Button1Click(Sender: TObject);
procedure ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof……
[/Quote]
请问下面这段代码什么意思
procedure TfrmCreep.Button1Click(Sender: TObject);
procedure ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
setlength(AStrings,AComboBox.Items.Count)
else
setlength(AStrings,AComboBox.Items.Count+1);
AStrings[0]:=AComboBox.text;
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
begin
AComboBox.Items.Delete(AComboBox.Items.Indexof(AComboBox.text));
AComboBox.text:=AStrings[0];
end;
if AComboBox.Items.Count>=1 then
begin
for I:=1 to AComboBox.Items.Count do
AStrings[I]:=AComboBox.Items[I-1];
end;
AComboBox.Items.Clear;
for I:=0 to High(AStrings) do
AComboBox.Items.Add(AStrings[I]);
if AComboBox.Items.Count >= 51 then
AComboBox.Items.Delete(50);
end;
请问下面这段代码什么意思
procedure TfrmCreep.Button1Click(Sender: TObject);
procedure ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
setlength(AStrings,AComboBox.Items.Count)
else
setlength(AStrings,AComboBox.Items.Count+1);
AStrings[0]:=AComboBox.text;
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
begin
AComboBox.Items.Delete(AComboBox.Items.Indexof(AComboBox.text));
AComboBox.text:=AStrings[0];
end;
if AComboBox.Items.Count>=1 then
begin
for I:=1 to AComboBox.Items.Count do
AStrings[I]:=AComboBox.Items[I-1];
end;
AComboBox.Items.Clear;
for I:=0 to High(AStrings) do
AComboBox.Items.Add(AStrings[I]);
if AComboBox.Items.Count >= 51 then
AComboBox.Items.Delete(50);
end;