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

📄 umain.pas

📁 模仿QQ的靠边停靠源码
💻 PAS
字号:
unit UMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, Menus, ComCtrls, ImgList, ToolWin;

{
  There are four panels placed aligned to each side of the main window,
  the only important properties to be set are:
  AutoSize = True                   // to hide panels when they aren't needed.
  BevelOuter = bvNone               // to get rid of raised panel border
  UseDockManager = True             // [DEFAULT] to engage Gavina DockManager
  DockSite = True                   // to engage Gavina DockManager
  FullRepaint = False               // to avoid flicking
  OnGetSiteInfo = CommonGetSiteInfo // to simulate side MS-docking style
}


type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu;
    N11: TMenuItem;
    N21: TMenuItem;
    N31: TMenuItem;
    N41: TMenuItem;
    N51: TMenuItem;
    N61: TMenuItem;
    N71: TMenuItem;
    N81: TMenuItem;
    N91: TMenuItem;
    N101: TMenuItem;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    StatusBar1: TStatusBar;
    Panel4: TPanel;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    Exit1: TMenuItem;
    procedure NewWindow1Click(Sender: TObject);
    procedure CommonGetSiteInfo(Sender: TObject; DockClient: TControl;
      var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
    procedure FormCreate(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
  private
    FForms: array[0..9] of TForm;
  end;

var
  Form1: TForm1;

implementation

uses UChild, GSDock;

{$R *.DFM}

procedure TForm1.NewWindow1Click(Sender: TObject);
var
  I: Integer;
begin
  I := TComponent(Sender).Tag;
  FForms[I].Show;
  FForms[I].SetFocus;
end;

procedure TForm1.CommonGetSiteInfo(Sender: TObject; DockClient: TControl;
  var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
begin
  // To avoid docking in non-MS zones
  GSGetSiteInfo(Sender, MousePos, CanDock);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to 9 do begin
    FForms[I] := TForm2.Create(Self);
    with FForms[I] do begin
      Name := Format('GreatestForm%d', [I + 1]);
      Caption := Format('Greatest Form #%d', [I + 1]);
    end;
  end;
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
  Close;
end;

end.

⌨️ 快捷键说明

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