本文整理自网络,侵删。
本例效果图:

代码文件:
--------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
procedure CheckBox1Click(Sender: TObject);
private
procedure MyMsg(var Msg: TWMNCHitTest); message WM_NCHITTEST;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) xor WS_CAPTION);
if not CheckBox1.Checked then begin Hide; Show; end;
end;
procedure TForm1.MyMsg(var Msg: TWMNCHitTest);
begin
Inherited;
if Msg.Result = HTCLIENT then Msg.Result := HTCAPTION;
end;
end.
相关阅读 >>
Delphi trestclient + trestrequest + trestresponse
Delphi 禁止用键盘左右箭头,去切换pagecontrol页签
Delphi ini文件操作 tinifile、tmeminifile
Delphi xe6 取得app自己的版本号(横跨4个平台)
Delphi firemonkey中listboxaccessory图标切换
更多相关阅读请进入《Delphi》频道 >>