Form doesn't resize smoothly with a timer event
Posted
by
BDotA
on Stack Overflow
See other posts from Stack Overflow
or by BDotA
Published on 2012-06-05T22:36:15Z
Indexed on
2012/06/05
22:40 UTC
Read the original article
Hit count: 130
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?
© Stack Overflow or respective owner