The titles says it all. I have a panel that acts as a white board. On mouse move draw the mouse track.. works fine, but if the mouse leaves the edges of the panel, i want to call the mouse up event and mouse down event if the the mouse leaves or enters the panel while the left button is down
private void panel2_MouseLeave(object sender, EventArgs e)
{
if (mousedraw == true)
{
panel2_MouseUp(sender, new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 0, MousePosition.X, MousePosition.Y, 0));
}
}
private void panel2_MouseEnter(object sender, EventArgs e)
{
if (mousedraw == true)
{
panel2_MouseDown(sender, new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 0, MousePosition.X, MousePosition.Y, 0));
}
}
mousedraw
is a bool
to know if the left button is down.
The Problem:
The leave and enter events will not fire if the mouse button is down.