using System;
using System.Windows.Forms;
public class Form1 : Form
{
public Form1()
{
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form_MouseClick);
}
static public void Main()
{
Application.Run(new Form1());
}
private void Form_MouseClick(Object sender, MouseEventArgs e)
{
switch (e.Button) {
case MouseButtons.Left:
MessageBox.Show(this,"Bal egérgomb lenyomva");
break;
case MouseButtons.Right:
MessageBox.Show(this,"Jobb egérgomb lenyomva" );
break;
case MouseButtons.Middle:
MessageBox.Show(this,"Középső egérgomb lenyova" );
break;
default:
break;
}
}
}
using System;
using System.Drawing;
using System.Windows.Forms;
class Program : Form
{
Label cimke1;
Program()
{
cimke1 = new Label();
cimke1.Text = "Helló Világ";
cimke1.Location = new Point(200, 200);
cimke1.MouseEnter += new EventHandler(Cimke_MouseEnter);
cimke1.MouseLeave += new EventHandler(Cimke_MouseLeave);
Controls.Add(cimke1);
Width = 800;
Height = 600;
}
private void Cimke_MouseEnter(object sender, EventArgs e)
{
cimke1.Text = "Rajta";
}
private void Cimke_MouseLeave(object sender, EventArgs e)
{
cimke1.Text = "Helló Világ";
}
public static void Main()
{
Application.Run(new Program());
}
}