delphi 实现无标题栏但有边框的窗口


本文整理自网络,侵删。

 本例效果图:


代码文件:
--------------------------------------------------------------------------------

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中编写无输出函数名的dll文件

Delphi 10.4.1的编译器bug终于修正了!

Delphi d10.x 在android 9及更高版本下使用Delphi获取设备序列号?

Delphi中使用tpathanimation

Delphi 运行时提升软件到管理员权限

Delphi xe2 - 实现无敌关机键

Delphi如何实现浏览文件夹

Delphi hook 指定程序窗体和控件的 wndproc

Delphi fmx 绘制非常精确的 时分秒针

Delphi 对指定dbgrid进行排序

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...