MaterialSkin icon indicating copy to clipboard operation
MaterialSkin copied to clipboard

WM form Messages not working as expected

Open DjSt3rios opened this issue 5 years ago • 2 comments

Hello everybody! I am trying to use a little mod that makes windows "stick" to each other, or to the edges of the screen. The mod is called StickyWindows However, if I use material skin form, as soon as I click on the titlebar, the window goes to the bottom right of the screen, but I can still move it.

I played around a bit to see if I could fix it, I found this piece of code in MaterialForm:

`// Status bar buttons else if (m.Msg == WM_LBUTTONDOWN && (_statusBarBounds.Contains(PointToClient(Cursor.Position)) || _actionBarBounds.Contains(PointToClient(Cursor.Position))) && !(_minButtonBounds.Contains(PointToClient(Cursor.Position)) || _maxButtonBounds.Contains(PointToClient(Cursor.Position)) || _xButtonBounds.Contains(PointToClient(Cursor.Position)))) {

            if (!_maximized)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
            else
            {
                _headerMouseDown = true;
            }
        }`

if I remove the SendMessage function, the window won't move at all. I tried changing the message to WM_COPYDATA, hoping I could edit a bit the StickyWindow class to look for that message and start moving the window, but I had no luck. I am not an expert and I can't really find a way around it, or what's the exact cause of it. Can someone help me?

DjSt3rios avatar Jun 11 '20 14:06 DjSt3rios

Hi, thanks for reporting "Mod" compatibility is not a priority for this lib. The issue here is (probably) the following: since the material form is com a completely custom form, I have to handle the user interactions with the form manually, this is what the piece of code you found does; and it's currently not well done as I didn't modify that part of the code too much from the original version. As a result, there are a few known bugs that need to be solved. I'll probably rewrite that code at some point to fix those issues, then maybe your issue will be solved too.

leocb avatar Jun 11 '20 18:06 leocb

Thank you for your time. I managed to narrow it down, I hope I will manage to fix it at some point. Have a great day!

DjSt3rios avatar Jun 11 '20 18:06 DjSt3rios