admin管理员组

文章数量:1026989

I want to create a custom component based on IntraWeb. I tried to create a simple component as coded below. It seems OK at design-time, but at run-time it does not appear on my page. What is the correct way to create a custom component for an IntraWeb application?

unit IWTestPK;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, IWVCLBaseControl,
  IWBaseControl, IWBaseHTMLControl, IWControl, IWCompExtCtrls, VCL.Graphics;

type
  TIWTest = class(TIWImage)
  private
    { Private declarations }
    SS:TStream;
  protected
    { Protected declarations }
    Procedure Paint; override;
    Constructor create(AoWner: Tcomponent); Override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TIWTest]);
end;

Constructor TIWTest.Create(AoWner: Tcomponent);
Begin
  Inherited Create(AoWner);
  SS:=TStream.Create;
End;

Procedure TIWTest.paint;
Begin
  Inherited Paint;
  Canvas.Pen.Color:=clRed;
  Canvas.Ellipse(1,1,Width,Height);
End;
end.

I want to create a custom component based on IntraWeb. I tried to create a simple component as coded below. It seems OK at design-time, but at run-time it does not appear on my page. What is the correct way to create a custom component for an IntraWeb application?

unit IWTestPK;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, IWVCLBaseControl,
  IWBaseControl, IWBaseHTMLControl, IWControl, IWCompExtCtrls, VCL.Graphics;

type
  TIWTest = class(TIWImage)
  private
    { Private declarations }
    SS:TStream;
  protected
    { Protected declarations }
    Procedure Paint; override;
    Constructor create(AoWner: Tcomponent); Override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TIWTest]);
end;

Constructor TIWTest.Create(AoWner: Tcomponent);
Begin
  Inherited Create(AoWner);
  SS:=TStream.Create;
End;

Procedure TIWTest.paint;
Begin
  Inherited Paint;
  Canvas.Pen.Color:=clRed;
  Canvas.Ellipse(1,1,Width,Height);
End;
end.

本文标签: delphiHow to create a custom component for an IntraWeb applicationStack Overflow