5,388
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.ComboBox1Change(Sender: TObject);
var
i:Integer;
s:string;
begin
i:=self.ComboBox1.ItemIndex;
if i=-1 then
Exit;
s:=self.ComboBox1.Items.Strings[i];
if Pos(' ',s)=0 then
Exit;
s:=Copy(s,1,2);
self.ComboBox1.Items.Strings[i]:=s;
self.Label1.Caption:=s;
self.ComboBox1.ItemIndex:=i;
end;
procedure TForm1.ComboBox1DropDown(Sender: TObject);
var
i:Integer;
s:string;
begin
i:=self.ComboBox1.ItemIndex;
if i=-1 then
Exit;
s:=self.ComboBox1.Items.Strings[i];
if Pos(' ',s)>0 then
Exit;
s:=s+' '+s+'1';
self.ComboBox1.Items.Strings[i]:=s;
self.ComboBox1.ItemIndex:=i;
end;