DynaPackColF.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit DynaPackColF;
- interface
- uses
- SysUtils, Windows, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons, TypInfo;
- type
- TForm1 = class(TForm)
- BtnChange: TButton;
- procedure BtnChangeClick(Sender: TObject);
- private
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.BtnChangeClick(Sender: TObject);
- var
- FormScroll: TForm;
- FormClass: TFormClass;
- HandlePack: HModule;
- begin
- // try to load the package
- HandlePack := LoadPackage ('PackWithForm.bpl');
- if HandlePack > 0 then
- begin
- FormClass := TFormClass(GetClass ('TFormScroll'));
- if Assigned (FormClass) then
- begin
- FormScroll := FormClass.Create (Application);
- try
- // initialize the data
- SetPropValue (FormScroll, 'SelectedColor', Color);
- // show the form
- if FormScroll.ShowModal = mrOK then
- Color := GetPropValue (FormScroll, 'SelectedColor');
- finally
- FormScroll.Free;
- end;
- end
- else
- ShowMessage ('Form class not found');
- UnloadPackage (HandlePack);
- end
- else
- ShowMessage ('Package not found');
- end;
- end.