   [.net] MouseUp event triggered on titlebar doubleclick
  When a user double clicks on a window's titlebar a MouseUp event is triggered. It doesn't make sense to me that this event is triggered.Does anyone know of a simple fix for this? Perhaps a way to detect the resizing of the window to ignore MouseUp event during this period?[Edited by - Headkaze on April 3, 2010 1:39:47 AM]
  Are you talking about WinForms? I do not get that behavior.   ;  I made a mistake in my original post. The message is MouseUp not MouseDown.To replicate the behaviour start a new project in Visual Studio and add a MouseUp event.private void Form1_MouseUp(object sender, MouseEventArgs e){MessageBox.Show("MouseUp");}Run it and double click on the titlebar to maximize the window and it should display the message box.   ;  Yes, that is what I saw in my experiment too.The only solution I see is by subscribing to the SizeChanged event and checking there whether the form got maximized (WindowState). If so, set a bool and check for the bool in the mouseup, resetting it when it was set. That way you ignore the MouseUp from the resize.It's a hack but the only thing I could come up with.using System;using System.Diagnostics;using System.Windows.Forms;namespace WindowsFormsApplication1{    public partial class Form1 : Form    {   private bool _justMaximized = false;   public Form1()   {  InitializeComponent();   }   private void Form1_MouseUp(object sender, MouseEventArgs e)   {  if (_justMaximized)  { _justMaximized = false; return;  }  Debug.WriteLine("MouseUp");   }   private void Form1_SizeChanged(object sender, EventArgs e)   {  Debug.WriteLine("SizeChanged");  _justMaximized = (WindowState == FormWindowState.Maximized);   }    }} [Edited by - ernow on April 3, 2010 10:25:11 AM];  It's probably happening because by the time you release the second click, the form has already maximized, and your mouse is now within the context of the form, thus you receive a MouseUp event.   ;Quote:Original post by FlimflamIt's probably happening because by the time you release the second click, the form has already maximized, and your mouse is now within the context of the form, thus you receive a MouseUp event.Let's face it, it's a bug. Thanks for the example ernow.   ;Quote:Original post by HeadkazeLet's face it, it's a bug. Thanks for the example ernow.Nope, it is working exactly the way it is suppose to.  It is not a bug, it is expected action.  theTroll;Quote:Original post by TheTrollNope, it is working exactly the way it is suppose to.  It is not a bug, it is expected action.I don't agree. There is no possible purpose this could be useful. Even so this behaviour has been annoying on at least 3 apps I've written that use the mouse for drawing.   ;Quote:Original post by HeadkazeQuote:Original post by TheTrollNope, it is working exactly the way it is suppose to.  It is not a bug, it is expected action.I don't agree. There is no possible purpose this could be useful. Even so this behaviour has been annoying on at least 3 apps I've written that use the mouse for drawing.MouseUp on Canvas from MS Forums.  It inlcudes an explaination of why it happens and another way around it.   ;Quote:Original post by RattrapMouseUp on Canvas from MS Forums.  It inlcudes an explaination of why it happens and another way around it.I didn't read any explaination or way around it. The last post is by the OP pasting in his onclick event with no solution. In his post before this he asks if it's "by design" and that it "can't be the desired behavior" and "is extremely problematic.".   