Własny komponent - problem z property Font.

0

Witam

Próbuje stworzyć własny komponent i nie zaszedłem daleko, mianowicie stanąłem na właściwościach.
Problem mam z uzyskaniem takiego efektu:

user image

type
  TLnkLabel = class(TCustomLabel)
  private
    { Private declarations }
    FHoverFont: TFont;
    FLnkIsCap: Boolean;
    FURL: String;

    procedure SetURL(Value: String);
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
    property Align;
    property Alignment;
    property Anchors;
    property AutoSize;
    property BiDiMode;
    property Caption;
    property Color;
    property Constraints;
    property DragCursor;
    property DragKind;
    property DragMode;
    property Enabled;
    property FocusControl;
    property Font;
    property Layout;
    property ParentBiDiMode;
    property ParentColor;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property ShowAccelChar;
    property ShowHint;
    property Transparent;
    property Visible;
    property WordWrap;

    property HoverFont: TFont read FHoverFont write FHoverFont;
    property LinkIsCaption: Boolean read FLnkIsCap write FLnkIsCap stored False;
    property URL: String read FURL write SetURL;
  end;

constructor TLnkLabel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FHoverFont := TFont.Create;
end;

Wszystko ładnie, pięknie póki nie otworzę okna z Fontem (kliknę na ...) i potwierdzę OK.
Access violation at addresss 40005A0C in module 'rtl70.bpl'. Read of address 252D440C.
Proszę o pomoc [???]

0

Nie wiem czy coś z Assign nie musisz napisać.

b

0

private
procedure SetHoverFont(Value: TFont);
published
property HoverFont: TFont read FHoverFont write SetHoverFont;

procedure TLnkLabel.SetHoverFont(Value: TFont);
begin
FHoverFont.Assign(Value);
end;

0

Dzięki, działa :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1