![]() |
Komponente erstellen - Wie ?
Hallo,
ich habe ein Panel mit verschiedenen Images drauf etc. Diese möchte ich jetzt als Komponente erstellen, sodass ich einfach son kleinen Button aufs Formular ziehen kann wie son TEdit usw. und schwupps habe ich wieder mein Panel mit den Bildern drauf. Wie kann ich sowas erstellen ? Hab schon bei delphi-source die Tutorials gelesen und weiß wie man ne Kompo erstellt aber wie funzt das wenn ich gleich noch andere Komponenten auf meiner drauf haben will. Danke im Voraus! mfg skunker |
Re: Komponente erstellen - Wie ?
Grundsätzlich genauso. Du Legst die "Unter"-Komponeneten als Member an, und sorgst dafür, das sie vom Constructor erzeugt und vom Destructor zerstört werden.
|
Re: Komponente erstellen - Wie ?
hmm hast du da eventuell ein simples Beispiel parat?
|
Re: Komponente erstellen - Wie ?
Hallo,
vielleicht kannst du dir ![]() Gruß, ManuMF |
Re: Komponente erstellen - Wie ?
hmm also mit diesem code will ich ein 20x20pixel großes shape links oben auf dem Panel haben welches ich erstelle nur wieso funzt das nicht:
Delphi-Quellcode:
unit MyPanel;
interface uses SysUtils, Classes, Controls, ExtCtrls,Graphics; type TMyPanel = class(TPanel) private image1: TShape; { Private-Deklarationen } protected { Protected-Deklarationen } public constructor Create(AOwner: TComponent); override; destructor Destroy; override; { Public-Deklarationen } published { Published-Deklarationen } end; procedure Register; implementation constructor TMyPanel.Create; begin inherited; image1:= TShape.Create(self); image1.Visible := true; image1.Left := 0; image1.Top := 0; image1.Width:= 20; image1.Height := 20; end; destructor TMyPanel.Destroy; begin image1.Free; inherited; end; procedure Register; begin RegisterComponents('Beispiele', [TMyPanel]); end; end. |
Re: Komponente erstellen - Wie ?
fehlt ein TShape.parent := self; denke ich.
Ratte |
Re: Komponente erstellen - Wie ?
ahh ok danke !!!
Jetzt gehts :) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:43 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz