const i = 1;
//初始测试数据
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.Items.CommaText := 'aaa,bbb,ccc';
ComboBox1.Items.CommaText := 'aaa,bbb,ccc';
end;
//对 ListBox1
procedure TForm1.Button1Click(Sender: TObject);
begin
// ListBox1.Selected[i] := True; {常规方法}
SendMessage(ListBox1.Handle, LB_SETCURSEL, i, 0); {发送消息}
end;
//对 ComboBox1
procedure TForm1.Button2Click(Sender: TObject);
begin
// ComboBox1.ItemIndex := i; {常规方法}
SendMessage(ComboBox1.Handle, CB_SETCURSEL, i, 0); {发送消息}
end;
转载于:https://my.oschina.net/hermer/blog/319548