Luiscencio
Luiscencio

Reputation: 3965

How can I dynamically move/resize a form?

I am doing an alert system that will show messages 'a la' Messenger, and I want them to move or resize to make them appear.

How can I do this without having to do this:

do
{
this.prop += 1;
} while (this. prop  = destination);

Upvotes: 0

Views: 603

Answers (3)

Benny
Benny

Reputation: 8815

set form.size property to change size, form.position to change position

Upvotes: 0

dicroce
dicroce

Reputation: 46830

You need a frame rate independent interpolator.

Take a look at: Frame Rate Independent interpolation. Basically, the idea is that you compute what your current position should be based upon the expected animation time and how long you've been animating... This means that the animation will take the same amount of time to go from point a to point b on any hardware.

Of course, you'll need to position the form with the values coming out of this, but thats the easy part!

Upvotes: 0

SLaks
SLaks

Reputation: 888273

You need to make a Timer component and call the form's SetBounds method in the timer's Tick event.

Upvotes: 3

Related Questions