Delphi TFrame flow as an ActiveX control

I am trying to wrap a TFrame descendant as an ActiveX control, but it seems I can not get the control to appear in the ActiveX control wizard. Is it possible that this approach is possible, and if so, are there any working examples to which you can pay attention.

I tried to follow the instructions here , but, as I said, the control show is displayed in the list of available controls.

Thanks in advance.

+2
source share
2 answers

@Mmarquee, an easy way to do this is to use Activeform , this is an ActiveX control that encapsulates a Delphi form, you can use the @Francois clause or the following approach, which makes it easy to deploy any standard form as an activex control.

First you need to create a new ActiveX control

alt text

then you add a new active form

alt text

Now you need to create a new standard form and place your component here.

Add the use of your standard form to the block where the TActiveForm is located and declare a variable of your standard form this way

 uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ActiveX, AxCtrls, Project75_TLB, StdVcl, Form1; //your unit with the standard form type TActiveFormX = class(TActiveForm, IActiveFormX) private ... public MyForm : TForm1; 

finally, in the oncreate ActiveForm event, you put the code to call the standard form and embed it in activeform.

 procedure TActiveFormX.ActiveFormCreate(Sender: TObject); begin MyForm := TForm1.Create(Self); //set the owner MyForm.Parent := Self;//embed the form MyForm.Align := alClient; MyForm.BorderStyle := bsNone; //hide the border of the form MyForm.Visible := True;//makes the form visible end; 

for more information check links to abstracts

+5
source

I think the easiest way to create your TFrame is normal, so you can use it in regular Delphi applications.
Then create an empty ActiveForm and put your frame in it.
And voila, you can use your ActiveForm wherever you want ...

+1
source

Source: https://habr.com/ru/post/915092/


All Articles