![]() |
Bitmap Property
Hallo!
ich habe eine published Bitmap-Property in meiner Komponente. Ich kann auch der Eigenschaft im Objektinspektor ein Bitmap zuweisen. Bei Start der Anwendung bekomme ich jedoch einen eReadError. Hat jemand eine Ahnung woran dies liegt? Hier mein Code:
Delphi-Quellcode:
MfG
unit TestButton;
interface uses Windows, Messages, SysUtils, Classes, Controls, StdCtrls, graphics,Dialogs; type TTestButton = class(TButton) private private fGlyph: TBitmap; procedure SetGlyph(bmp:TBitmap); function GetGlyph:TBitmap; { Private-Deklarationen } protected { Protected-Deklarationen } public constructor Create(AOwner: TComponent); destructor Destroy; { Public-Deklarationen } published property Glyph: TBitmap read GetGlyph write SetGlyph; { Published-Deklarationen } end; procedure Register; implementation procedure Register; begin RegisterComponents('Themed', [TTestButton]); end; { TestButton } constructor TTestButton.Create(AOwner: TComponent); begin inherited Create(AOwner); fGlyph:=TBitmap.Create; end; destructor TTestButton.Destroy; begin fGlyph.Free; fGlyph:=nil; inherited Destroy; end; function TTestButton.GetGlyph: TBitmap; begin if fGlyph=nil then begin result:=nil; exit; end; result:=TBitmap.Create; result.Assign(fGlyph); end; procedure TTestButton.SetGlyph(bmp: TBitmap); begin if fGlyph=nil then fGlyph:=TBitmap.Create; fGlyph.Assign(bmp); end; end. TheSaint |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:55 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