如何实现这样一个功能:一个标签其caption为:***@hotmail.com。我想让它被点击是,能启动outlook来给这个地址发送邮件。(最好还能帮我实现象delphi的帮助对话框里的标签那样的明亮效果,和有下划线。)
谢谢!

解决方案 »

  1.   

    uses ShellAPI;procedure TForm1.Label1Click(Sender: TObject);
    begin
      ShellExecute(Handle, nil, PChar(TLabel(Sender).Caption), nil, nil, SW_SHOW);
    end;
      

  2.   

    Label1.Caption = 'mailto:[email protected]';
    //or
    Label1.Caption = 'http://kingron.myetang.com';
      

  3.   

    再设置一下Label的字体,就可以了
      

  4.   

    Label1.Caption = 'mailto:[email protected]';
    LabelMouseDown
    ShellExecute(handle,nil,pchar('mailto:[email protected]'),nil,nil,sw_shownormal);LabelMouseDown
     Label.Font.Color:=clBlue;
      

  5.   

    继承label控件,增加鼠标移入移出功能,可改变颜色,字体等。unit MIOLabel;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TMIOLabel = class(TLabel)
      private
       FColor:TColor;
       FMouseEnter:TNotifyEvent;
       FMouseLeave:TNotifyEvent;
       FontColor:TColor;
        { Private declarations }
        procedure WmMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
        procedure WmMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
      protected
        { Protected declarations }
      public
       constructor Create(AOwner : TComponent); OverRide;
        { Public declarations }
      published
       property OnMouseEnter:TNotifyEvent Read FMouseEnter Write FMouseEnter;
       property OnMouseLeave:TNotifyEvent Read FMouseLeave Write FMouseLeave;
       Property MouseInColor:TColor read FColor Write FColor default clred;
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Samples', [TMIOLabel]);
    end;{ TMIOLabel }
    constructor TMIOLabel.Create(AOwner: TComponent);
    begin
      inherited;
      Fcolor:=Clred;
      Font.Color :=Clblue;
      Cursor:=crHandPoint;
    end;procedure TMIOLabel.WmMouseEnter(var Message: TMessage);
    begin
      inherited;
      if (Message.Msg = CM_MOUSEENTER) then begin
        FontColor:=Font.Color ;
        Font.Color:=FColor;
        Font.Style :=Font.Style +[fsUnderline];
        if Assigned(FMouseEnter) then   FMouseEnter(self);
      end;end;procedure TMIOLabel.WmMouseLeave(var Message: TMessage);
    begin
       inherited;
       if (Message.Msg = CM_MOUSELEAVE) then begin
          Font.Color:=FontColor;
          Font.Style :=Font.Style -[fsUnderline];
          if Assigned(FMouseLeave) then  FMouseLeave(self);
       end;end;end.