Beranda > Delphi > Create a hot URL link in the About box

Create a hot URL link in the About box

Many programs have an About box with a WWW address in it. When the user clicks on that address, it will launch the webbrowser automatically and connect with the given site.

How to accomplish this?

Create your label component with the URL as it's caption. Set the font's color to 'blue' and style 'underline' so that it looks like a link.

uses ShellAPI;
..
TAboutBox = class(TForm)
..
URLLabel : TLabel;
end;
..
URLLabel.Cursor := crAppStart; { set this in the object inspector }
..

{ onClick event handler }
procedure TAboutBox.URLLabelClick(Sender: TObject);
var TempString : array[0..79] of char;
begin
StrPCopy(TempString,URLLabel.Caption);
ShellExecute(0, Nil, TempString, Nil, Nil, SW_NORMAL);
end;

Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: