我想当光标进入到一个组合框时,我想用F2健模拟鼠标点下的情况,请问怎样实现,其他的健是怎样的代码?比如说F1健

解决方案 »

  1.   

    procedure TForm1.ComboxKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
    begin
        if Key = 112 then  //F1
        begin
           Key:=1; //mouse left button
        end
        else if key = 113 then  //F2
        begin    end;end;
      

  2.   

    在 OnKeyUp中處理
    procedure TForm1.ComboBox1KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
        if Key = 112 then  //F1
        begin
           ComboBox1.DroppedDown := true;
    //       ComboBox1.DroppedDown := not ComboBox1.DroppedDown;
        end;
    end;
      

  3.   

    procedure TForm1.ComboBox1KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
        if Key = 112 then 
        begin
           ComboBox1DroppedDown(nil);
           ComboBox1.DroppedDown := true;
           ...........................//将鼠标点击的触发事件全部调用了就行了
        end;
    end;