连接用label
label onclick
  shellexecute(params)
字体颜色及下划线在label onmousemove 设置
label.text.color:=clblue;form1 onmousemove
 设置为默认属性

解决方案 »

  1.   

    unit mylabel;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls,ShellApi;
    type
      TLinkKind = (hlHTTP, hlMail, hlTelnet, hlGopher, hlNews, hlFTP);type
      TLabel1 = class(TLabel)
      private
        LinkColor  :TColor;
        FLinkKind: TLinkKind;
        { Private declarations }
        procedure CMMOUSEENTER(var Amag:TMessage);message CM_MOUSEENTER;
        procedure CMMOUSELEAVE(var AMag:TMessage);message CM_MOUSELEAVE;
      protected
        { Protected declarations }
        property Color:TColor read LinkColor write LinkColor;
      public
        { Public declarations }
        constructor Create(AOwner: TComponent); Override;
        procedure   Click;Override;
      published
        { Published declarations }
        property LinkKind:TLinkKind read FLinkKind write FLinkKind;  end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Standard', [TLabel1]);
    end;{ TLabel1 }procedure TLabel1.Click;
    begin
      inherited Click;
      if Self.Caption<>'' then
      begin
        Case FLinkKind of
          hlHTTP   :ShellExecute(parent.handle,nil,pchar('http://'+Self.Caption),nil,nil,sw_shownormal);
          hlMail   :ShellExecute(parent.handle,nil,pchar('mailto:'+Self.Caption),nil,nil,sw_shownormal);
          hlFTP    :ShellExecute(parent.handle,nil,pchar('ftp://'+Self.Caption),nil,nil,sw_shownormal);
          hlNews   :ShellExecute(parent.handle,nil,pchar('news:'+Self.Caption),nil,nil,sw_shownormal);
          hlGopher :ShellExecute(parent.handle,nil,pchar('gopher://'+Self.Caption),nil,nil,sw_shownormal);
          hlTelnet :ShellExecute(parent.handle,nil,pchar('telnet:'+Self.Caption),nil,nil,sw_shownormal);
        end;
      end;
    end;procedure TLabel1.CMMOUSEENTER(var Amag: TMessage);
    begin
      Self.Font.Color :=clBlue;
      Self.Font.Style :=[fsUnderLine];
    end;procedure TLabel1.CMMOUSELEAVE(var AMag: TMessage);
    begin
      Self.Font.Color :=clRed;
      Self.Font.Style :=[];
    end;constructor TLabel1.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      Self.Cursor :=crHandPoint;
      Self.Font.Color :=clRed;end;end.
    给你一个控件,这个可以实现你的要求。
      

  2.   

    Onlick:
    ShellExecute(handle,nil,pchar(label1.caption),nil,nil,
    sw_shownormal);================================================================
    一颗红心向前看,为了革命两茫然,不好意思才囊尽,只能说上一点点。
    ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
    ★    我踢  我踢   我踢  我踢  我踢  我踢  我踢  我踢  我踢   ★
    ★    你UP  你UP   你UP  你UP  你UP  你UP  你UP  你UP  你UP   ★
    ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
    ================================================================