Form Mouse Up event
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class FormMouseUpEvent : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public FormMouseUpEvent()
{
this.MouseUp += new MouseEventHandler(OnMouseUp);
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
[STAThread]
static void Main()
{
Application.Run(new FormMouseUpEvent());
}
protected void OnMouseUp(object sender, MouseEventArgs e)
{
// Which mouse button was clicked?
if(e.Button == MouseButtons.Left)
MessageBox.Show("Left click!");
if(e.Button == MouseButtons.Right)
MessageBox.Show("Right click!");
if(e.Button == MouseButtons.Middle)
MessageBox.Show("Middle click!");
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
|