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

📄 utils.pas

📁 观察者模式delphi实例实现,同时注意软件的设计
💻 PAS
字号:
unit utils;

interface

uses
    Windows, Messages, SysUtils, Graphics, Forms, Dialogs, Controls, classes
    , inifiles, mmsystem;

procedure ShowFormAsChild(var AForm: TForm; AFormClass: TClass;
                            AParent: TWinControl; AlignClient:Boolean = True);

implementation

{******************************************************************************}
procedure ShowFormAsChild(var AForm: TForm; AFormClass: TClass;
                            AParent: TWinControl; AlignClient:Boolean = True);
var
    acW,acH:Integer;
    i:Integer;
begin
    if not Assigned(AForm) then
        Application.CreateForm(TComponentClass(AFormClass), AForm);
    for i := 0 to AParent.ControlCount -1 do
    begin
        if AParent.Controls[i] is TForm then
            TForm(AParent.Controls[i]).Hide;
    end;
    AForm.Parent        := AParent;
    AForm.Left          := 0;
    AForm.Top           := 0;
    if AlignClient then
        AForm.Align := alClient;
    acW := AForm.ClientWidth;
    acH := AForm.ClientHeight;
    AForm.BorderStyle   := bsNone;
    AForm.Width         := acW;
    AForm.Height        := acH;
    AForm.BringToFront;
    AForm.Show;
end;


end.

⌨️ 快捷键说明

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