procedure TForm1.WMCOMBOBOXDROPDOWN(var WinMsg: TMessage);
// WM_COMBOBOXDROPDOWN Message Handler
var
OldTopIndex, NewTopIndex: Integer;
begin
if ComboBox1.Items.Count >= 2 then
begin
OldTopIndex := ComboBox1.Perform(CB_GETTOPINDEX, 0, 0);
while True do
begin
Application.ProcessMessages;
ComboBox1.Perform(CB_SETTOPINDEX, OldTopIndex - 2, 0);
NewTopIndex := ComboBox1.Perform(CB_GETTOPINDEX, 0, 0);
if OldTopIndex - 2 = NewTopIndex then
Break;
end;
end;
end;
콤보박스의 OnDropDown 이벤트에 아래와 같이 코딩해보세요...
procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
TComboBox(Sender).ItemIndex := TComboBox(Sender).Perform(CB_FINDSTRING, -1, LongInt(PChar(TComboBox(Sender).Text)));
end;
^^ 항상 즐코하세요...