请问下面这段代码什么意思 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 ChangeItem(AComboBox:TComboBox); var I:integer; AStrings:array of String; begin if AComboBox.Items.Indexof(AComboBox.text)>=0 then//如果AComboBox中有AComboBox.text 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元素 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; //清楚AComboBox for I:=0 to High(AStrings) do AComboBox.Items.Add(AStrings[I]);//将AStrings中的值赋给AComboBox if AComboBox.Items.Count >= 51 then AComboBox.Items.Delete(50);//删除第50个 end;
array[1..5000]of double是定义了一个有5000个元素的double类型数组
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 ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof(AComboBox.text)>=0 then//如果AComboBox中有AComboBox.text
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元素
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; //清楚AComboBox
for I:=0 to High(AStrings) do
AComboBox.Items.Add(AStrings[I]);//将AStrings中的值赋给AComboBox
if AComboBox.Items.Count >= 51 then
AComboBox.Items.Delete(50);//删除第50个
end;