⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitform1.pas

📁 《Delphi实用程序100例》配套书源码盘
💻 PAS
字号:
unit unitForm1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, ToolWin;

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    procedure ToolBar1EndDock(Sender, Target: TObject; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ToolBar1EndDock(Sender, Target: TObject; X, Y: Integer);

var
  H: THandle;
begin
  H := GetParent(ToolBar1.Handle);//ToolBar在拖出来之后被"套进"另一个窗口里了
  if H <> ToolBar1.Handle then begin//以下的操作都是针对这个临时的父窗口的
    SetWindowLong(H, GWL_STYLE, GetWindowLong(H, GWL_STYLE) and not WS_SYSMENU);//把它的关闭按钮去掉
    ShowWindow(H, SW_HIDE);//这两句是为了让它刷新,使关闭按钮马上消失
    ShowWindow(H, SW_SHOW);//如果没有这两句,必须移动一下或者调整一下大小才行
  end;
end;



end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -