首页 > 代码库 > delphi无边框可拖动窗体
delphi无边框可拖动窗体
unit UFrmModless;interfaceuses 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.
delphi无边框可拖动窗体
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。