delphi新手,写了一个小程序,我想按下F12的时候 ,实现点击button1的功能
,点击button1就直接执行我写的程序了,然后按下F11,停止所有程序运行。当然能教我前边的就行了。请给我源码吧,源码应该也不难,我是新手,十分感谢,求源码,求源码!...
,点击button1就直接执行我写的程序了,然后按下F11,停止所有程序运行。当然能教我前边的就行了。请给我源码吧,源码应该也不难,我是新手,十分感谢,求源码,求源码!
展开
1个回答
展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms,
Dialogs, Menus, Buttons, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
MainMenu1: TMainMenu;
hgfhf1: TMenuItem;
hgfhfg1: TMenuItem;
fghfg1: TMenuItem;
Button2: TButton;
quit1: TMenuItem;
procedure fghfg1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure quit1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.fghfg1Click(Sender: TObject); {快捷键F12 对应的菜单项}
begin
Form1.Button1Click(Sender);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('ghgfhgf');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
halt;
end;
procedure TForm1.quit1Click(Sender: TObject); {快捷键F11 对应的菜单项}
begin
Form1.Button2Click(Sender);
end;
end.
只有菜单项才能定义快捷键,以上程序是将菜单项和button按钮绑定 实现。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询