Bescheriebung:
LinkLabel, per Klick auf ein Label mit neuen Eigenschaften eine
URL öffnen.
Komponente: LinkLabel
- alle Eigenschaften eines Labels
-
property Url:
String Url-Adresse
-
property AskBeforeOpenURL:
Boolean Vor dem öffnen des Links fragen
-
property Hover:
Boolean Eigenschaft(en) ändern wenn Maus über dem Label ist
-
property HoverFontColor:
TColor Hover Schrift Farbe
-
property HoverFontStyle:
TFontStyles Hover Schrift Stiel
Delphi-Quellcode:
type
TLinkLabel =
class(
TLabel)
private
FUrl:
string;
FAsk: boolean;
FHoverFontColor: TColor;
FHoverFontStyle: TFontStyles;
FHover: Boolean;
//
TmpColor: TColor;
TmpStyle: TFontStyles;
procedure OpenUrl(TheUrl:
string);
protected
procedure OnMouseEnter;
dynamic;
procedure OnMouseLeave;
dynamic;
procedure CMMouseEnter(
var Message: TMessage);
message CM_MOUSEENTER;
procedure CMMouseLeave(
var Message: TMessage);
message CM_MOUSELEAVE;
public
constructor Create(Owner: TComponent);
override;
destructor Destroy;
override;
procedure Click;
override;
published
property Url:
string read FUrl
write FUrl;
property AskBeforeOpenURL: boolean
read FAsk
write FAsk;
property Hover: Boolean
read FHover
write FHover;
property HoverFontColor: TColor
read FHoverFontColor
write FHoverFontColor;
property HoverFontStyle: TFontStyles
read FHoverFontStyle
write
FHoverFontStyle;
end;
procedure Register;
implementation
...