Label's Generic event : Control Event : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » Control Event »

 

Label's Generic event








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

public  class  LabelWithGenericEvent  :  System.Windows.Forms.Form
{
    private  System.Windows.Forms.Label  lblTitle;

    public  LabelWithGenericEvent()
    {
        InitializeComponent();
    }

    private  void  InitializeComponent()
    {
        this.lblTitle  =  new  System.Windows.Forms.Label();
        this.SuspendLayout();
        //  
        //  lblTitle
        //  
        this.lblTitle.Location  =  new  System.Drawing.Point(40,  24);
        this.lblTitle.Name  =  "lblTitle";
        this.lblTitle.Size  =  new  System.Drawing.Size(150,  25);
        this.lblTitle.TabIndex  =  0;
        this.lblTitle.Text  =  "Events  Demonstrator";
        this.lblTitle.Click  +=  new  System.EventHandler(this.GenericEventHandler);
        this.AutoScaleBaseSize  =  new  System.Drawing.Size(5,  13);
        this.ClientSize  =  new  System.Drawing.Size(242,  173);
        this.Controls.AddRange(new  System.Windows.Forms.Control[]  {    this.lblTitle});
        this.ResumeLayout(false);

    }
    [STAThread]
    static  void  Main()  
    {
        Application.Run(new  LabelWithGenericEvent());
    }
    private  void  GenericEventHandler(object  sender,  EventArgs  e)
    {
        MessageBox.Show("Generic  event  handler","Event  Demo");
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» Control Event