combobox分列显示问题
我有这么个问题
combobox控件的属性为默认。
items为
a 1000
b 2000
c 3000
我要用户在选择下拉列表选择后,显示出来的只是a或b或c,不带数字。
这是我的代码
procedure TForm1.ComboBox1Select(Sender: TObject);
var
tmpstr:string;
ch_index:integer;
begin
tmpstr:=combobox1.Items.Strings[combobox1.itemIndex];
//showmessage(tmpstr)='a 1000'
ch_index:=pos(' ',tmpstr);
//showmessage(copy(tmpstr,0,ch_index-1))='a'
if ch_index>0 then
combobox1.Text:=copy(tmpstr,0,ch_index-1);//这句有问题
end;
但结果不行,它显示出了完整结果(a 1000)。
另外,要怎么做才能让'a'左对齐,'1000'右对齐?
麻烦大家了。