+ 3

c# button animations

i'm working on simple project in WinForm c# .net 4.8 and i'm pretty done , but the problem that i have to add some animations when clicking on any button like that one on "Material You". any suggestions ?!

8th Nov 2022, 6:11 AM
Yousef Eabitan
Yousef Eabitan - avatar
1 Answer
+ 1
Create a single method to add the appropriate handlers for a button, and then just write the code once to handle any given button. Note that you can go into the expand/contract tick handlers and use the percentComplete value to set the height as well, to move the color along a spectrum (this would involve some mathematics of colors to do though) or to alter any other aspect of the button. If you're really motivated to generalize it you could add a parameter to the method of Action<double> that does something to the object based on the given percent progress. https://code.sololearn.com/cWXERYD4Rj9y/?ref=app
12th Nov 2022, 10:58 PM
Mohammad Reza Farzam
Mohammad Reza Farzam - avatar