NoTitleF.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit NoTitleF;
  2. interface
  3. uses
  4.   SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls;
  6. type
  7.   TForm1 = class(TForm)
  8.     Label1: TLabel;
  9.     Button1: TButton;
  10.     Label2: TLabel;
  11.     procedure Button1Click(Sender: TObject);
  12.   private
  13.     { Private declarations }
  14.   public
  15.     procedure CreateParams (var Params: TCreateParams); override;
  16.     procedure HitTest (var Msg: TWmNcHitTest);
  17.       message wm_NcHitTest;
  18.   end;
  19. var
  20.   Form1: TForm1;
  21. implementation
  22. {$R *.DFM}
  23. procedure TForm1.CreateParams (var Params: TCreateParams);
  24. begin
  25.   inherited CreateParams (Params);
  26.   Params.Style := (Params.Style or ws_Popup) and
  27.     not ws_Caption;
  28. end;
  29. procedure TForm1.HitTest(var Msg: TWmNcHitTest);
  30. begin
  31.   inherited;
  32.   if (Msg.Result = htClient) and (Msg.YPos <
  33.       Label1.Height + Top + GetSystemMetrics (sm_cyFrame)) then
  34.     Msg.Result := htCaption;
  35. end;
  36. procedure TForm1.Button1Click(Sender: TObject);
  37. begin
  38.   Close;
  39. end;
  40. end.