![]() |
Re: Bild in eine Buttonkomponente??
Das bedeutet du weisst nur nicht wie man eine Eigenschaft definiert die ein Bild aufnimmt um es dann auch zum Zeichnen zu nutzen?
Delphi-Quellcode:
So, das ist alles. Ohne Gewähr, da hier im Forum getippt.
type
TButttonKompo = class(TCustomControl) private fBild: TBitmap; procedure SetBild(AValue: TBitmap); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Paint; override; published property Bild: TBitmap read fBild write SetBild; end; ... constructor TButtonKompo.Create(AOwner: TComponent) begin inherited; fBild := TBitmap.Create; end; destructor TButtonKompo.Destroy; begin fBild.Free; inherited; end; procedure TButtonKompo.SetBild(AValue: TBitmap); begin fBild.Assign(AValue); Invalidate; end; procedure TButtonKompo.Paint; begin if not fBild.Empty then self.Canvas.Draw(0, 0, fBild); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:29 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