leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
446 stars 132 forks source link

Fix Designer resizing form due to the WS_SIZEFRAME style flag #232

Closed VolatilePulse closed 3 years ago

VolatilePulse commented 3 years ago

This should close #227. I was unable to see the issues I was experiencing the other night on this branch, so this should properly implement Aero Snapping. I will continue exploring with my other branch to reproduce the issue I noticed with the WM_NCCALCSIZE Windows Message.

orapps44 commented 3 years ago

Hi,

Unfortunnately it fix issue only in designer mode but when app is running form size is incorrect.

VolatilePulse commented 3 years ago

I tested this locally last night with all of the latest changes and couldn't reproduce that issue. Can you provide specific steps to reproduce and I'll look again tonight? Thanks!

orapps44 commented 3 years ago

You can use that one :

https://github.com/orapps44/MaterialSkin-login_test

On first opened form we can notice difference between designer mode and debug mode with button distance from from edge.

VolatilePulse commented 3 years ago

I am unsure how I missed this in my testing, but this is definitely a big issue. I looked for some answers to this issue last night and was unable to find a simple solution. I'll update the branch to temporarily remove the aero snapping via the Size Frame style. I will have to work on a proper solution down the road due to my current workload. I'm sorry this wasn't as easy as I first expected.

VolatilePulse commented 3 years ago

For the time being, I have disabled the WS_SIZEFRAME style from the CreateParams property.

I've outlined the potential steps to approach this in the future, but as stated earlier, I do not have enough time to investigate at the moment, but I would like to implement this for not only my use case, but also for others that may want some of the native Windows behavior.

VolatilePulse commented 3 years ago

I finally found a fix for this issue. I've spent probably close to 50 hours researching this. I'll clean up the code and do a bit more testing this evening, but it appears to just work.

orapps44 commented 3 years ago

Hi @VolatilePulse ,

Thanks a lot for your work and time. I will review your code tonight

valimaties commented 3 years ago

I don't know if this is important, but look at #227 as there is a strange behavior for MaterialTextBox2 in this branch.

VolatilePulse commented 3 years ago

I did see your comment there and I believe it is related to the handling of the WM_NCACTIVATE message. I will take a look at reproducing that this evening and seeing what solution I can come up with.

To be clear, this issue should have been present with the initial merged PR and my commit last night should not have affected this.