I'm trying to understand how the SpeedButton
Glyph
property work, I find that the field declared as:
FGlyph: TObject;
While the property
as:
property Glyph: TBitmap read GetGlyph write SetGlyph stored HasCustomGlyph;
That put me in a way where I can't understand that code even if I read it line by line, when I was trying to create my own SpeedButton
that accepts .PNG
images too instead of .bmp
images only.
For the first time I was thinking to declare the property as TPicture
instead of TBitmap
.
Is there any way to create MySpeedButton with Glyph : TPicture
?
What I try is below:
TMyButton = class(TSpeedButton)
private
//
FGlyph: TPicture;
procedure SetGlyph(const Value: TPicture);
protected
//
public
//
published
//
Property Glyph : TPicture read FGlyph write SetGlyph;
end;
And the procedure:
procedure TMyButton.SetGlyph(const Value: TPicture);
begin
FGlyph := Value;
end;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…