leocb / MaterialSkin

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

Scrollable Drawer on MouseWheel and Click'n'Move implementation #306

Closed valimaties closed 2 years ago

valimaties commented 2 years ago

This is based on #236 which is based on #163 . #236 is better coded, as long as it will increments/decrements the Height of the drawer (the right divider is higher enough, will not stops when scrolling up, in #163 the divider was shorter and it was shorter when scrolling up). I removed the EnableScrolling property from MaterialDrawer control, as long as we need this option all the time. Scrolling option does not affect Drawer as long as its content is not higher than itself.

BTW: Reading Material Design implementation, about showing ScrollBar, (as you @orapps44 asked for in your comment in #236 ) NavigationDrawer does not shows any scrollbar when scrolls or when mouse hover. This is the implementation of Material Design scrolling techniques. It just scrolls container if childs are in the non visible area of control.

Using this technique we can go forward and implement Drawer SubMenu items, as @ryanrox asked for it in #177 or in the latest #293

Demo: ScrollableDrawer

orapps44 commented 2 years ago

That looks good, but it needs to be slightly improved. Currentely drawer is designed as a form "stciked" to main form. Due to that scrolling only works on drawer if drawer form is focused. I expect drawer scrolling to works without need fot user to click on it to get focus.

valimaties commented 2 years ago

That looks good, but it needs to be slightly improved. Currentely drawer is designed as a form "stciked" to main form. Due to that scrolling only works on drawer if drawer form is focused. I expect drawer scrolling to works without need fot user to click on it to get focus.

I don't click on drawer, I click on other objects and mouse over drawer wheel will scroll. I currently work on an update, which user can scroll by click-n-move drawer.

Demo: ScrollableDrawer2

valimaties commented 2 years ago

I've solved some bugs in initial commit, because drawer will not resize correctly when scrolling using MouseWheel. I've added possibility to scroll drawer by click and move drawer up and down. It will not change the current tab page if it detects that the last click on button was to scroll drawer. Since Drawer maintain current approach, will work. As soon as @volatilepulse will implement his Drawer (Rework - #244 currently closed, but I'm sure he working on that) maybe my code will need some adjustments.

Demo: ScrollableDrawerWithClickNMove

orapps44 commented 2 years ago

I don't click on drawer, I click on other objects and mouse over drawer wheel will scroll.

I've tried it with win 7, I will try again this evening with windows 10.

valimaties commented 2 years ago

I don't click on drawer, I click on other objects and mouse over drawer wheel will scroll.

I've tried it with win 7, I will try again this evening with windows 10.

Yes, indeed. I've tried right now in a Virtual W7 environment, and seems wheel scroll does not work until drawer has focus. But I've made some research and now it is ok. Works even on Windows 7 😊

PS: My tests shows that this new MaterialDrawerForm class and the MessageFilter class does not affect the behavior in W10, but allow to work on W7.

Demo: ScrollableDrawerWithClicknMoveW7

Have BUGS. This commit will be deleted...

valimaties commented 2 years ago

Seems there are some problems after last commit, it affects form size and other things, like anchor... I will make some research to see what is going on... So I will delete last commit....

valimaties commented 2 years ago

As long as Windows 7 is out of support, I propose to merge this PR, as long as it works on OS'es greater than W7. Personally, I don't use anymore W7 anymore on all my PCs and also my clients has upgraded their systems to W10 or W11. I think although it is a small problem with WheelScroll on W7, there is now a Click'n'Move option to scroll drawer. Personally, I want it to go forward in codding 😚 Maybe we can create childs in Drawer.

valimaties commented 2 years ago

Hi @orapps44 . Could you try last commit on your side? Windows 7, Windows 10, MaterialSkinExample, your other projects... Works fine on my side, on W7 or greater.

orapps44 commented 2 years ago

Hi @valimaties ,

I confirm that works fine with W7 & W10.

Thanks for this new contribution.