对于button的热键设置我们可以在capition中,用&加字母来实现,但是它用的是alt键,button又没有shortcut属性,如果想要用其他的,比如ctrl+字母键,或是象F10功能键来实现,那要怎么实现啊?等待您的回复......

解决方案 »

  1.   

    procedure TfrmAskPriceBill.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState);
    begin
        Case key of
           vk_f3:
           begin
               btnSaveClick(nil);
           end;
           vk_f4:
           begin
               btnDeleteClick(nil);
           end;
           vk_f6:
           begin
               btnStorageFindClick(nil);
           end;
           vk_f7:
           begin
               btnPriceClick(nil);
           end;
           vk_f8:
           begin
               btnGoodsInfoClick(nil);
           end;
           vk_f9:
           begin
               btnPrintClick(nil);
           end;
           VK_ESCAPE:     //ESC键
           begin
               btnEXITClick(nil);
           end;
           VK_DELETE:
           begin
               key:=0;
               N2Click(NIL);
           end;
           VK_INSERT:
           begin
               key:=0;
               N1Click(NIL);
           end;
          if (ssCtrl in Shift) and (chr(Key) in ['N', 'n']) then   //Ctrl+N
           begin
               btnNewClick(NIL);
           end;
           if (ssCtrl in Shift) and (chr(Key) in ['O', 'o']) then   //Ctrl+O
           begin
               btnOpenClick(NIL);
           end;
           if (ssCtrl in Shift) and (chr(Key) in ['G', 'g']) then   //Ctrl+G
           begin
               btnOpenInClick(NIL);
           end;
    end;