Delphi中TRzPageControl实现多窗口的融合窗口详细方法

delphi9年前 (2017)发布 admin
638 0
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RzTabs;
 
type
  TForm1 = class(TForm)
    page1: TRzPageControl;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    procedure PageAddForm(mform:TForm;TmFormClass:TClass);
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses Unit2;
 
{$R *.dfm}
 
{ TForm1 }
 
procedure TForm1.PageAddForm(mform: TForm; TmFormClass: TClass);
begin
    application.CreateForm(TcomponentClass(TmFormClass),mForm);
    // mForm.show;
    mForm.ManualDock(page1);
    mForm.Visible :=true; //这种方法的效果比用 show的效果要好一些
    page1.ActivePageIndex :=page1.PageCount-1;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
   pageAddForm(Form2,TForm2);
end;
 
end.
 
 
============================
 
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TForm2 = class(TForm)
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form2: TForm2;
 
implementation
 
{$R *.dfm}
 
end.

https://www.cnblogs.com/hnxxcxg/archive/2010/08/04/2940686.html
https://blog.csdn.net/sdudubing/article/details/6790374

© 版权声明

相关文章