Announcement

Collapse
No announcement yet.

PaintBox auf nem Panel

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PaintBox auf nem Panel

    <p>Moin!</p>
    <p>Meine Komponente basiert auf TPanel und sie besitzt eine PaintBox.
    Wenn ich nun aber auf diese PaintBox zugreifen will (SVGPanel.PaintBox.Canvas...), erhalte ich eine Fehlermeldung der Art "Element besitzt kein übergeordnetes Fenster".</p>

    <p>Was ist falsch?</p>

    <pre>
    unit SVGPanel;

    interface

    uses
    SysUtils, Classes, Controls, ExtCtrls, SVGParser, Dialogs;

    type
    TSVGPanel = class(TPanel)
    private
    { Private-Deklarationen }
    protected
    { Protected-Deklarationen }
    public
    { Public-Deklarationen }
    PaintBox : TPaintBox;
    published
    { Published-Deklarationen }
    constructor create(AOwner: TComponent); override;
    end;

    procedure Register;

    implementation

    procedure Register;
    begin
    RegisterComponents('Beispiele', [TSVGPanel]);
    end;

    constructor TSVGPanel.create(AOwner : TComponent);
    begin
    inherited create(AOwner);
    PaintBox:=TPaintBox.Create(self);
    PaintBox.Align:=alClient;
    end;
    </pre>

  • #2
    Hallo !

    Die Paintbox braucht zuerst ein Parent bevor Du auf das Canvas zugreifen kannst.

    Grüße
    Hah

    Comment


    • #3
      Genau, das ist zu erledigen mit:

      <pre>
      PaintBox.parent:=self;
      </pre&gt

      Comment

      Working...
      X