大是们帮我讲解一下!
http://jmusic.66ip.com/mysoft/temp/ls.rar

解决方案 »

  1.   


    unit ChildFrm;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Menus;type
      TChildForm = class(TForm)
        MainMenu1: TMainMenu;
      private
        FAsChild:boolean;
        FTempParent:TWinControl;
        { Private declarations }
      protected
        Procedure createparams(var params:TcreateParams);override;
        procedure Loaded;override;
      public
        constructor create(AOwner:tcomponent);overload;override;
        constructor Create(aowner:tcomponent;aparent:twincontrol);reintroduce;overload;
        Function GetFormMenu:TMainMenu;virtual;abstract;
        function CanChange:boolean;virtual;
        { Public declarations }
      end;var
      ChildForm: TChildForm;implementation{$R *.dfm}
    constructor tchildform.create(aowner:tcomponent);
    begin
      FASchild:=false;
      inherited create(aowner);
    end;
    constructor tchildform.Create(aowner:tcomponent;aparent:twincontrol);
    begin
      faschild:=true;
      ftempparent:=aParent;
      inherited create(aowner);
    end;
    procedure tchildform.Loaded;
    begin
      inherited;
      if faschild then
      begin
        align:=alclient;
        borderstyle:=bsnone;
        bordericons:=[];
        parent:=ftempparent;
        position:=podefault;
      end;
    end;
    procedure tchildform.createparams(var params:tcreateparams);
    begin
      inherited createparams(params);
      if faschild then
      params.Style :=params.Style or ws_child;
    end;
    function tchildform.CanChange :boolean;
    begin
      result:=true;
    end;
    end.