Welcome

首页 / 软件开发 / Delphi / Delphi 2009中的TLinkLabel实例

Delphi 2009中的TLinkLabel实例2012-02-02 cnblogs 万一本例效果图:

代码文件:

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
LinkLabel1: TLinkLabel;
procedure FormCreate(Sender: TObject);
procedure LinkLabel1LinkClick(Sender: TObject; Link: string;
LinkType: TSysLinkType);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses ShellAPI;
procedure TForm1.FormCreate(Sender: TObject);
begin
LinkLabel1.Caption := "<a href="http://del.cnblogs.com">万一的 Delphi 博客</a>";
end;
procedure TForm1.LinkLabel1LinkClick(Sender: TObject; Link: string;
LinkType: TSysLinkType);
begin
ShellExecute(0, nil, PChar(Link), nil, nil, 1);
end;
end.