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.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
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.java2java.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.java2java.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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.