unit1.pas

来自「Delphi编程实效百例的随书程序 这是其中的界面操作部分」· PAS 代码 · 共 59 行

PAS
59
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
{$R MYCURSOR.RES}

const
  crMyCursor = 100;

var
  MyIcon: TIcon;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MyIcon := TIcon.Create;
  MyIcon.Handle := LoadIcon(hInstance, MAKEINTRESOURCE('MyIcon'));

  Screen.Cursors[crMycursor] := LoadCursor(hInstance, MAKEINTRESOURCE('MyCursor'));
  Memo1.Cursor := crMyCursor;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Application.Icon := MyIcon;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  MyIcon.Free;

{ MyCursor don't need to free because Delphi does it for us }

end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?