![]() |
TImage als Parent
Gibt es eine Möglichkeit TImage so zu verändern, dass es ähnlich wie TPanel Parent von anderen Controls sein kann?
|
Re: TImage als Parent
Wenn TImage von TGraphicControl abstammt nicht, wenn es von TWinControl abstammt, ja.
Hab grad kein Delphi zur Hand, aber das wäre meine erste Überlegung. |
Re: TImage als Parent
Zwei Ideen, beide ungetestet:
Uli. |
Re: TImage als Parent
Zitat:
|
Re: TImage als Parent
Zitat:
|
Re: TImage als Parent
Ich habe jetzt folgendes geschrieben, aber das funktioniert nicht.
Delphi-Quellcode:
unit ImagePanel;
interface uses SysUtils, Classes, Controls, ExtCtrls; type TImagePanel = class(TImage) private { Private-Deklarationen } protected { Protected-Deklarationen } public constructor Create(AOwner: TComponent); override; published { Published-Deklarationen } end; procedure Register; implementation procedure Register; begin RegisterComponents('Standard', [TImagePanel]); end; constructor TImagePanel.Create(AOwner: TComponent); begin inherited Create(AOwner); ControlStyle := ControlStyle + [csAcceptsControls]; end; end. |
Re: TImage als Parent
Zitat:
Zitat:
Hast du das Ganze in der IDE installiert - d.h. in ein Package gepackt und dieses compiliert und installiert? |
Re: TImage als Parent
Zitat:
Ich konnte nicht wie bei Panels andere Controls in mein TImagePanel einfügen. |
Re: TImage als Parent
Hallo,
auch durch Ableiten kann man aus einem TImage keinen TWinControl-Nachfolger machen. Es wird also weder über ein Controls-Array verfügen, noch kann es Parent eines anderen Controls werden. Die erste Überlegung von Julius (Beitrag #2) war somit richtig. Warum möchtest du das Image unbedingt als Parent haben? Kannst du dein Ziel nicht auf einem anderen Weg erreichen? Gruß Hawkeye |
Re: TImage als Parent
Mir würde auch ein transparentes Panel ausreichen.
Dieses müsste aber auch auf einem GlassFrame transparent sein. |
Re: TImage als Parent
Zitat:
Also Aggregation, etwa so:
Delphi-Quellcode:
Das funktioniert mit Erzeugen zur Laufzeit. Für Designzeit-Unterstützung braucht's wohl noch etwas Feinschliff. :mrgreen:
TImagePanel = class(TCustomPanel)
private FImage: TImage; public constructor Create(AOwner: TComponent); override; property Image: TImage read FImage; end; constructor TImagePanel.Create(AOwner: TComponent); begin inherited Create(AOwner); AutoSize := True; FImage := TImage.Create(Self); FImage.Parent := Self; end; |
Re: TImage als Parent
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:50 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