LinkLabelコントロールはクリッカブルなLabelコントロールです。
例えば、Textプロパティーに http://www.yahoo.co.jp/
のようなURLを設定しておき、クリックされた際の LinkClicked イベントを捕捉して
ブラウザを開くサンプルは次のようになります。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { // ブラウザを起動 System.Diagnostics.Process.Start(linkLabel1.Text); } catch(Exception ex) { // エラー System.Diagnostics.Debug.WriteLine(ex.Message); } } } }
コメントを残す