Form doesn't resize smoothly with a timer event
- by BDotA
I have a grid control at the bottom of my form and it can be shown or hidden if user wants to show/hide it. So one way was to well use AutoSize of the form and change the Visuble property of that grid to true or false,...
But I thought let's make it a little cooler! so I wanted the form to resize a little more slowly, like a garage door! So I dropped a Timer on the form and started increasing the height of the form little by little while the timer ticks...
so something like this when user says show/hide the grid:
timer1.Enabled = true;
timer1.Start();
and something like this on the timer_click event:
this.Height = this.Height + 5;
if(this.Height -10 > ErrorsGrid.Bottom )
timer1.Stop();
It kind of works but still not perfect. For example it lags at the very beginning, stop a like a second and then start moving it...So now with this idea in mind what alterations do you suggest I should do to make this thing look and work better?