delphi无边框可拖动窗体

unit UFrmModless;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TFrmModeless = class(TForm)
lblInfo: TLabel;
btnClose: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
private
{ Private declarations }
procedure WMNCHITTEST(var Msg:TWMNCHITTEST);message WM_NCHITTEST;
public
{ Public declarations }
procedure CreateParams(var params: TCreateParams); override;
end; var
FrmModeless: TFrmModeless; implementation {$R *.dfm}
procedure TFrmModeless.CreateParams(var params: TCreateParams);
begin
inherited CreateParams(params);
params.Style := WS_THICKFRAME or WS_POPUP or WS_BORDER;
end; procedure TFrmModeless.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
Msg.Result:=HTCaption;
end; procedure TFrmModeless.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
// FrmModeless := nil;
end; procedure TFrmModeless.FormDestroy(Sender: TObject);
begin
FrmModeless := nil;
end; procedure TFrmModeless.btnCloseClick(Sender: TObject);
begin
self.Close;
end; end.

  

上一篇:Java程序员的现代RPC指南(Windows版预编译好的Protoc支持C++,Java,Python三种最常用的语言,Thrift则支持几乎主流的各种语言)


下一篇:autoHotKey 一些脚本积累