代码之家  ›  专栏  ›  技术社区  ›  Rowan

如何使TLabel在Delphi中表现得像超链接?

  •  7
  • Rowan  · 技术社区  · 16 年前

    如何使TLabel在Delphi中表现得像超链接?

    4 回复  |  直到 16 年前
        1
  •  24
  •   DmitryK    16 年前

    procedure TForm1.Label1Click(Sender: TObject);
    var
      MyLink: string;
    begin
      MyLink := 'http://www.mysite.com/';
      ShellExecute(Application.Handle, PChar('open'), PChar(MyLink),    
       nil, nil, SW_SHOW);
    end;
    
        2
  •  7
  •   moobaa    16 年前

    • 将字体颜色设置为蓝色
    • 使用鼠标上的[Enter|Leave|Move]事件将下划线样式适当地应用于字体
    • 使用OnClick事件生成浏览器&根据需要更改字体颜色。
        3
  •  1
  •   Community Mohan Dere    9 年前

    你使用的是哪个版本的Delphi?查看我的Delphi 4 IDE,TLabel没有OnMouseEnter/OnMouseLeave事件,当用户将鼠标悬停在“链接”上时,将光标更改为“手”是必要的。

    How to bring front or launch browser in Delphi

        4
  •  0
  •   Uli Gerhardt    16 年前

    人们可以在浏览器中标记并聚焦链接。因此,我会考虑为此任务使用窗口控件(如所有者绘制的TButton)。

    推荐文章