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;

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-09-27
  • 2021-05-30
  • 2022-02-10
猜你喜欢
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案