thanks sparrow 1
but i can't see any different sizes so somewhere there'd need to be a form refresh.
I'm trying to give the form,when it opens,a zoom effect.
;-)
thanks sparrow 1
but i can't see any different sizes so somewhere there'd need to be a form refresh.
I'm trying to give the form,when it opens,a zoom effect.
;-)
Hi,
Sorry forgot to tell you to set the size of your Form in design time to
Width = 200, height = 100, then you'll see the difference.
Wkr,
sparrow1
Wkr,
sparrow1
If I helped you, don't forget to Rate my post. Thank you
The most likely cause of the issue is that the form is being resized before you actually see it. Try moving the code into the FormActivated event. Also you should use an if statment like sparrows example, instead of a loop, unless you plan on looping.
What exactly are you trying to achieve? Your code doesn't make any sense because you're using a Do loop yet it can't possibly make more than one iteration. Also, where have you placed that code? You can't refresh a form that isn't displayed so it can't be of any use whatsoever if it is executed before the Shown event is raised.
The code seems a bit off...
You will need to provide what sort of output or input you are looking for.
For instance, what is the reasoning behind the refresh and the do while loop.
Also you may want to use AND or ANDAlso why are you using & ?
if you want it to grow from small to big do like this:
VB Code:
Me.Size= New Size(1,1)
Do Until Me.Width=500
Me.Width += 1
Me.Height += 1
Loop
But the second code should be threaded, and preferably have a pause in it to make it noticeable.
This is on the right track...But it's still not going to work. This is goign to increment the form size so quickly that you still won't see a change. You need to use a timer. In the formload start the timer then in the timers tick event do this
VB Code:
If Me.Width < 500
Me.Width += 1
Me.Height += 1
Else
timer1.Enabled = False
End If
Then using this you would just play with the interval of the timer to get teh desired speed for the form to grow.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Timer1.Interval = 1.5
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Me.Width < 500 Then
Me.Width += 1
Me.Height += 1
Else
Timer1.Enabled = False
End If
End Sub
End Class
but the form just keeps on sizing it's self.
Paste code so i can do this right.
P.S I want the whole form to size instead of the right-hand side.
but we are on the right track.
:-)
The interval should be set before you start the timer. Also The interval is set in milliseconds. Also the interval is an integer, so it can't be a partial millisecond. That is why I gave you the link.
Are you sure the form is reaching 500? Add a label to the form and in the timer's event put
VB Code:
label1.Text = me.Width.ToString 'assuming the new label is called label1
This will tell if the form is going past the requested hieght.
If you want the form to look centered when the size is increasing you are also going to have to change the location of the form every time you change the size.
Can I just confirm exactly what you're trying to do here? You're trying to make the form appear using a transition effect, correct? If so then there is an AnimateWindow API that provides several effects without any code other than declaring the function and calling it. Two lines of code and you get access to four different effects. One fades in and out, one slides the form in and out from one edge, one rolls the form in and out form one edge and the lasts rolls the form in and out from the centre. I've posted code in the CodeBank that wraps this API in a manged class, so you can just add an instance of the class to your form and call the appropriate method.
Then the tooltip covers up the rest. There's certainly an error in that code. If toastForm was an actual type, two things would happen:
1) Dim toastForm as would be an error, no matter what type it was.
2) You would not be getting the error you are getting on the line you are getting it.
OK, my left eye is twitching. Did you read through the first post in that thread? It explains what the FormAnimator class is and it explains what the ToastForm class is. A code file for each class is attached to the post. If the ToastForm class isn't defined in your project then that means that you haven't downloaded the ToastForm code file and added it to your project.
Apart from that, you shouldn't be using the ToastForm class anyway. It's a demo of how you can use the FormAnimator class. It's specifically designed as a form that will popup and back down just above the system tray. That's not what you want. You should be using just the FormAnimator class. Simply create an instance in your form and pass the appropriate values to the constructor for the effect you want, EXACTLY as I explained in that post.