LinkLabel Clicked event : LinkLabel « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » GUI Windows Form » LinkLabelScreenshots 
LinkLabel Clicked event
LinkLabel Clicked event


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{
      private System.Windows.Forms.LinkLabel driveLinkLabel;
      private System.Windows.Forms.LinkLabel deitelLinkLabel;
      private System.Windows.Forms.LinkLabel notepadLinkLabel;
      
      public Form1() {
        InitializeComponent();
      }

      private void driveLinkLabel_LinkClickedobject sender, LinkLabelLinkClickedEventArgs e )
      {
        driveLinkLabel.LinkVisited = true;
        System.Diagnostics.Process.Start@"C:\" );
      

      private void deitelLinkLabel_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e )
      {
        deitelLinkLabel.LinkVisited = true;
        System.Diagnostics.Process.Start( "IExplore", "http://www.java2s.com" );
      }

      private void notepadLinkLabel_LinkClickedobject sender, LinkLabelLinkClickedEventArgs e )
      {
         notepadLinkLabel.LinkVisited = true;
         System.Diagnostics.Process.Start"notepad" );
      }

      private void InitializeComponent()
      {
         this.driveLinkLabel = new System.Windows.Forms.LinkLabel();
         this.deitelLinkLabel = new System.Windows.Forms.LinkLabel();
         this.notepadLinkLabel = new System.Windows.Forms.LinkLabel();
         this.SuspendLayout();
         // 
         // driveLinkLabel
         // 
         this.driveLinkLabel.AutoSize = true;
         this.driveLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif"12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
         this.driveLinkLabel.Location = new System.Drawing.Point(2824);
         this.driveLinkLabel.Name = "driveLinkLabel";
         this.driveLinkLabel.Size = new System.Drawing.Size(13320);
         this.driveLinkLabel.TabIndex = 0;
         this.driveLinkLabel.TabStop = true;
         this.driveLinkLabel.Text = "Click to browse C:\\";
         this.driveLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.driveLinkLabel_LinkClicked);
         // 
         // deitelLinkLabel
         // 
         this.deitelLinkLabel.AutoSize = true;
         this.deitelLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif"12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
         this.deitelLinkLabel.Location = new System.Drawing.Point(2868);
         this.deitelLinkLabel.Name = "deitelLinkLabel";
         this.deitelLinkLabel.Size = new System.Drawing.Size(19820);
         this.deitelLinkLabel.TabIndex = 1;
         this.deitelLinkLabel.TabStop = true;
         this.deitelLinkLabel.Text = "Click to visit www.java2s.com";
         this.deitelLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.deitelLinkLabel_LinkClicked);
         // 
         // notepadLinkLabel
         // 
         this.notepadLinkLabel.AutoSize = true;
         this.notepadLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif"12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
         this.notepadLinkLabel.Location = new System.Drawing.Point(28114);
         this.notepadLinkLabel.Name = "notepadLinkLabel";
         this.notepadLinkLabel.Size = new System.Drawing.Size(14720);
         this.notepadLinkLabel.TabIndex = 2;
         this.notepadLinkLabel.TabStop = true;
         this.notepadLinkLabel.Text = "Click to run Notepad";
         this.notepadLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.notepadLinkLabel_LinkClicked);
         // 
         // LinkLabelTestForm
         // 
         this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
         this.ClientSize = new System.Drawing.Size(261164);
         this.Controls.Add(this.notepadLinkLabel);
         this.Controls.Add(this.deitelLinkLabel);
         this.Controls.Add(this.driveLinkLabel);
         this.Name = "LinkLabelTestForm";
         this.Text = "LinkLabelTest";
         this.ResumeLayout(false);
         this.PerformLayout();

      }
      [STAThread]
      static void Main()
      {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
      }
}


           
       
Related examples in the same category
1.Change LinkColor after it has been clickedChange LinkColor after it has been clicked
2.About Box LinksAbout Box Links
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.