As the title says...
I got a rectangle that servers as the title bar for my custom window. I want to add a handler to a mouseUp event on said rectangle. I did... But the event only ever fires when the window is maximized and never when normalized.
I have tried attaching the handler shown to rectangle.MouseUp, rectangle.MouseLeftButtonUp and rectangle.PreviewMouseLeftButtonUp. With MouseUp and PreviewMouseUp, right button fires the event while left does not.
private void rctHeader_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
mRestoreIfMove = false;
POINT lMousePosition;
if (GetCursorPos(out lMousePosition) && lMousePosition.Y <= 10
&& WindowState != WindowState.Maximized)
{
WindowState = WindowState.Maximized;
}
}
I have a breakpoint on mRestoreIfMove line and it only gets hit in a maximized window on mouseUp. Clicking the mouse does nothing on the normalized window.
SOLVED:
MouseDown handler called DragMove(); at the end. For some reason, after DragMove, the mouseUp event does not fire.
Sorry, I should have included the mouseUp event code aswell.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.