What goes up must come down...
What goes up must come down… So you might think that after each CellMouseDown event you recieve a CellMouseUp event… Well, here is some code that proves that isn’t always true
public partial class Form1 : Form
{
private string lastEvent;
public Form1()
{
InitializeComponent();
this.dataGridView1.ColumnCount = 10;
this.dataGridView1.RowCount = 10;
}
public string LastEvent
{
get { return this.lastEvent; }
set {
if (this.lastEvent == value)
{
MessageBox.Show("i've detected two " + value + " after each other");
}
this.lastEvent = value;
}
}
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
LastEvent = "MouseDown";
}
private void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
{
LastEvent = "MouseUp";
}
}
And with a bit of a twisted optical mouse it’s pretty easy to see the following MessageBox
After a bit of research i also found the following at MouseEventArgs