⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.~pas

📁 《Delphi实用程序100例》配套书源码盘
💻 ~PAS
字号:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ShowSize;
    procedure RestrictSize(var msg: TMessage); message WM_GETMINMAXINFO;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ShowSize;
begin
   Label1.Caption := IntToStr(Width)+'X'+IntToStr(Height);
end;

procedure TForm1.RestrictSize(var Msg: TMessage);
var
   p: PMinMaxInfo;
begin
// The lParam contains a pointer on a structure of type TMinMaxInfo
   p := PMinMaxInfo(Msg.lParam);
// This represents the size of the Window when Maximized
   p.ptMaxSize.x := 320;
   p.ptMaxSize.y := 240;
// This represents the position of the Window when Maximized
   p.ptMaxPosition.x := 10;
   p.ptMaxPosition.y := 10;
// This represents the minimum size of the Window
   p.ptMinTrackSize.x := 320;
   p.ptMinTrackSize.y := 240;
// This represents the maximum size of the Window
   p.ptMaxTrackSize.x := 400;
   p.ptMaxTrackSize.y := 320;
end;

end.
 

⌨️ 快捷键说明

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