?? mainunit.pas
字號:
unit mainunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Showmessage('主窗體的句柄是:'+IntToStr(Form1.Handle));
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Button1.SetFocus;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Showmessage('當前鼠標點擊的按鈕的句柄是:'+IntToStr(Button2.Handle));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if (Application.MessageBox('是否決定改變主窗體的標題','詢問',MB_OKCANCEL + MB_OK)=ID_OK) then
begin
SetWindowText(Form1.Handle, Pchar(Edit1.Text));
if (Edit1.Text='')then
ShowMessage('用戶將主窗體的標題設置為空!')
else
ShowMessage('用戶將主窗體的新標題設置為:'+Edit1.Text);
Button3.SetFocus;
end
else
begin
ShowMessage('用戶取消了修改主窗體標題的操作!');
Button3.SetFocus;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -