Ich wollte mein TPanelEx um eine Font erweitern die bei der Überschrift benutzt wird (nicht die normale Font...) Ich hab das jetzt so probiert:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
| private FCaptionFont: TFont; procedure SetCaptionFont(const Value: TFont); published property CaptionFont: TFont read FCaptionFont write SetCaptionFont;
inherited Create(AOwner); FCaptionFont := TFont.Create; FCaptionFont.Size := 12; FCaptionFont.Color := clBlack;
FCaptionFont.Free; inherited Destroy;
procedure TPanelEx.SetCaptionFont(const Value: TFont); begin FCaptionFont.Assign(Value); end; |
Ich bekomme aber eine Zugriffsverlezung (EAccessViolation) an Adresse xyz.... Was ist da falsch?
//Edit:
Komischerweise aber nur beim Lesen Oo; Wenn ich nicht auslese sondern nur in Create schreibe passiert nichts... Parent gibts ja nicht... Außerdem wüsste ich gern was ich nehmen soll in Create:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7:
| constructor TPanelEx.Create(AOwner: TComponent); begin inherited Create(AOwner); FCaptionFont := TFont.Create; FCaptionFont.Size := 12; FCaptionFont.Color := clBlack; end; |
or
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7:
| constructor TPanelEx.Create(AOwner: TComponent); begin inherited Create(AOwner); CaptionFont := TFont.Create; CaptionFont.Size := 12; CaptionFont.Color := clBlack; end; |
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.