procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
  if (key=#13)and(combobox1.Text<>'') then
    begin
      combobox1.Items.Add(combobox1.Text);
      combobox1.SelStart:=0;//这里 这句话 有什么用?
      combobox1.Text:='';
    end ;
    在这程序里combobox1.selstart:=0有什么用? combobox1.selstart用来定义什么属性的?

解决方案 »

  1.   

    在这里这句代码我看不出有什么用处。关于SelStart属性的用处,还是用一个Edit来解释一下吧,意思是一样的:请运行后自己看效果,就明白了。procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit1.SetFocus;
      Edit1.SelStart := 1;
      Edit1.SelLength:= 3;
    end;
      

  2.   

    combobox1.selstart  是 选择的开始是在哪;
    如果combobox1.sellength=0 的话 就是 光标的显示处好象是combobox的item增删过;combobox1.SelStart 都会跳的;
    我遇到过;combobox.item.clear 后;combobox的SelStart  就自动跳到第一个去了