The objective is to keep a Boolean variable in High state for 2 seconds after a button is pressed.
The Variable should be in high state when Mouse_Down event is fired. Also the variable should be high for the next 2 seconds also, after the MouseUp event is fired. So basically I want to create a delay between these two events.
Is there any way to do this?
bool variable;
private void button1_MouseDown(object sender, EventArgs e)
{
variable = true; // This variable should be true for 2 seconds after mouseUp event is fired.
}
private void button1_MouseUp(object sender, EventArgs e)
{
variable = False;
}