-
Feb 13th, 2010, 07:34 PM
#1
Thread Starter
New Member
Expandable Forms
IN vb.net, how would i be able to create expandable forms? For example, you have a form , and you click a button, expanding the form to a new size. i currently hav a button that uses a while loop to increment the increasing and decreasing size to make it look animated. any other options?
Code Example
Code:
While frm_Main.Width > 430
frm_Main.Width -= 3.5
End While
While frm_Main.Height > 130
frm_Main.Height -= 3.5
End While
-
Feb 13th, 2010, 07:38 PM
#2
Thread Starter
New Member
Re: Expandable Forms
***********i could have also said collapsable forms etc.
-
Feb 13th, 2010, 09:06 PM
#3
Addicted Member
Re: Expandable Forms
You can prbly try the same with a Timer control on your form and putting the "frm_Main.Width -=3.5" line in its Tick event.
Somewhat like this:
vb Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If Me.Width > 430 Then Me.Width -= 10 End If If Me.Height > 130 Then Me.Height -= 10 End If If (Me.Width = 430) AndAlso (Me.Height = 130) Then Timer1.Stop() End If End Sub
Last edited by garyjohn_2000; Feb 13th, 2010 at 09:17 PM.
Anyone who has never made a mistake has never tried anything new. - Einstein
Peace!
-
Feb 13th, 2010, 10:35 PM
#4
Lively Member
Re: Expandable Forms
or you can do
Code:
Do Until me.Height= 500
me.Height = me.height +2
Loop
Or To do for the the width
Code:
Do Until me.Width= 500
me.Width = me.Width +2
Loop
This will do a continuous motion
But Just Make sure width you are going to go must be divisible by the number by which you are adding
-
Feb 13th, 2010, 10:43 PM
#5
Re: Expandable Forms
Originally Posted by watson123
or you can do
Code:
Do Until me.Height= 500
me.Height = me.height +2
Loop
Or To do for the the width
Code:
Do Until me.Width= 500
me.Width = me.Width +2
Loop
This will do a continuous motion
But Just Make sure width you are going to go must be divisible by the number by which you are adding
Or make it so it's checking for a Greater than Equal to instead of just an Equal to:
Code:
Do Until Me.Width >= 500
Me.Width = Me.Width +2
Loop
Or more commonly:
Code:
While Me.Width < 500
Me.Width += 2
End While
Personally I would use a Timer so you get the animation effect if you're only incrementing by 2, or in the loop stick a 'Me.Refrssh() so it forces a form paint at the new size before expanding it even more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|