Link to home
Start Free TrialLog in
Avatar of delpro
delpro

asked on

component count in TCustomPanel

Im busy writing a component and i want to know how many components is in the component(TCustomPanel) at desine time

Here is the program

unit test;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, ExtCtrls,DB, DBTables;

type
  TRPPage = class(TCustomPanel)
  private
    { Private declarations }
  protected
    { Protected declarations }
    procedure Paint; override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

var
  NComp:integer;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Test', [TRPPage]);
end;

procedure TRPPage.Paint;
var
  Rect: TRect;
  i:integer;
 begin
  Rect := GetClientRect;
  with Canvas do
  begin
    Brush.Color := RGB(255,255,255);
    FillRect(Rect);
    Rectangle(0, 0, Width, Height);
    {Componentcount don't work here}
    canvas.textout(50,50,inttostr(ComponentCount));
  end;
 end;


end.

ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial