zoukankan      html  css  js  c++  java
  • delphi TcxPageControl 动态嵌入窗体

    type
      TMyForm_test = class(TForm)
        cxpgcntrl1: TcxPageControl;
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    type
      Applicationclass = class(TObject)
        class procedure addforms(Form: TForm);
        class function returnTcxPageControl: TcxPageControl;
        class procedure addMDIChild(MDIChildFormClass: TFormClass; var Reference; MenuName: string; midform: TFormClass);
      end;
    
    var
      MyForm_test: TMyForm_test;
    
    implementation
    
    uses
      UnitTest123;
    
    {$R *.dfm}
    
    procedure TMyForm_test.FormCreate(Sender: TObject);
    var
      temp: TFormTest123;
    begin
      temp := TFormTest123.Create(nil);
      temp.Caption := '测试下';
      Applicationclass.addMDIChild(TFormTest123,temp,temp.Caption,TFormTest123);
    end;
    
    class procedure Applicationclass.addforms(Form: TForm);
    var
      Sheet: TCXTabSheet;
    begin
      Sheet := TCXTabSheet.Create(returnTcxPageControl);
      Sheet.font.size := 14;
      Sheet.font.Name := 'MS Sans Serif';
      Sheet.font.Style := [];
      Sheet.caption := Form.caption;
      Sheet.handles := Form.Handle;
      Sheet.Pform := Form;
      Sheet.PageControl := returnTcxPageControl;
      Sheet.ImageIndex := 0;
      Sheet.Tag := 2;
      Form.Parent := Sheet;
      Applicationclass.returnTcxPageControl.activePage := Sheet;
    end;
    
    class function Applicationclass.returnTcxPageControl: TcxPageControl;
    begin
      result := MyForm_test.cxpgcntrl1;
    end;
    
    class procedure Applicationclass.addMDIChild(MDIChildFormClass: TFormClass; var Reference; MenuName: string; midform: TFormClass);
    var
      MDIChildForm: TForm;
      I: Integer;
      WHandle: HWnd;
      Step: Integer;
    begin
      with Application.MainForm do
      begin
        LockWindowUpdate(GetDeskTopWindow);
        try
          Screen.Cursor := crHourglass;
        except
          LockWindowUpdate(0);
          Screen.Cursor := crDefault;
          Application.ShowException(Exception(ExceptObject));
          Abort;
        end;
        try
          MDIChildForm := TForm(Reference);
          MDIChildForm.Parent := returnTcxPageControl;
          MDIChildForm.WindowState := wsMaximized;
    
          MDIChildForm.BorderIcons := [biMinimize, biMaximize];
          Applicationclass.addforms(MDIChildForm);
          MDIChildForm.Visible := true;
        finally
          Screen.Cursor := crDefault;
          LockWindowUpdate(0);
        end;
      end;
    end;
  • 相关阅读:
    DBSCAN算法及sklearn实现
    K-MEANS算法及sklearn实现
    Linux删除有规则文件夹,比如(50-100)
    11.tensorboard网络结构
    10.优化器
    9.正则化
    8.Dropout
    Linux中awk后面的RS, ORS, FS, OFS 含义
    hadoop 客户的的使用
    shell中的>&1和 >&2是什么意思?
  • 原文地址:https://www.cnblogs.com/yangxuming/p/7852543.html
Copyright © 2011-2022 走看看