• 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;
  • 相关阅读:
    ubuntu 访问 共享 windows文件夹
    ubuntu下android环境的搭建
    smb使用 ------转载自http://blog.csdn.net/tlaff/article/details/5463068
    oracle jar
    悬浮按钮
    移动开发赚钱
    截取scrollview的滑动事件,传递给子控件
    put ListView in a ScrollView(bug fixed)
    35岁前务必成功的12级跳
    mysql分页原理和高效率的mysql分页查询语句
  • 原文地址:https://www.cnblogs.com/yangxuming/p/7852543.html
Copyright © 2020-2023  润新知