弱:combobx中如何禁止写入而只能从combobox的下拉框中选择?(10分)

M

maginnn

Unregistered / Unconfirmed
GUEST, unregistred user!
弱:combobx中如何禁止写入而只能从combobox的下拉框中选择?
 
令其Style属性为csDropDownList
 
combobox1.Style := csDropDownList;
 
禁止键盘输入,就可以了!应该不难吧!
nhqing@ynmail.com
 
和Adnil的意见一样。
 
procedure TForm1.ComboBox1KeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
abort;
end;

procedure TForm1.ComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
abort;
end;

procedure TForm1.ComboBox1KeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
abort;
end;
 
我一直用csDropDownList,今天才知还有别的方法,开阔思路,受益受益
 
还有一种方法就是在KeyPress事件中写key := #0
 
简洁为好csDropDownList
 
sorry 分太少了,看样只能要给2个人了
 
顶部