Results 1 to 5 of 5

Thread: Expandable Forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    9

    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

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    9

    Re: Expandable Forms

    ***********i could have also said collapsable forms etc.

  3. #3
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    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:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Timer1.Start()
    3.     End Sub
    4.  
    5.  
    6.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    7.         If Me.Width > 430 Then
    8.             Me.Width -= 10
    9.         End If
    10.         If Me.Height > 130 Then
    11.             Me.Height -= 10
    12.         End If
    13.  
    14.         If (Me.Width = 430) AndAlso (Me.Height = 130) Then
    15.             Timer1.Stop()
    16.         End If
    17.     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!

  4. #4
    Lively Member
    Join Date
    Feb 2010
    Posts
    120

    Cool 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

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Expandable Forms

    Quote Originally Posted by watson123 View Post
    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.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width