Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] Animated Form Extend [SRC]
#1
The following is an example of how to increase the height of your form & decrease it back to the original size (This example uses a form where Height = 222, and will be increased to Height = 250).

Imports:
Code:
Imports System.Runtime.InteropServices

Function:
Code:
<DllImport("user32.dll", SetLastError:=True)> _
Friend Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
    End Function

Using:
Code:
If Me.Height < 250 Then
            Timer1.Start()
        Else
            Timer2.Start()
        End If

Timer1:
Code:
If (MyBase.Width < 500) Then

            Form1.MoveWindow(MyBase.Handle, (MyBase.Left - 0), (MyBase.Top - 0), (MyBase.Width + 0), (MyBase.Height + 2), True)
            If Me.Height = 250 Then
                Me.Timer1.Enabled = False
            End If
        End If
MsgBox("Extended!")

Timer2:
Code:
If (MyBase.Width < 500) Then

            Form1.MoveWindow(MyBase.Handle, (MyBase.Left - 0), (MyBase.Top - 0), (MyBase.Width + 0), (MyBase.Height - 2), True)
            If Me.Height = 222 Then
                Me.Timer2.Enabled = False
            End If
        End If
MsgBox("Retracted!")

This is a really cool effect to add to your applications. Hope you all like it.
Reply
#2
Thanks for this tutorial mate.
Reply
#3
This is pretty cool. I never thought of animating the resizing of a form.
Reply
#4
I'll give this a try soon, thank you for sharing.
Reply
#5
nice tutorial Smile

i'll try this. thanks for sharing
Reply
#6
I created a module for this (somewhat) although it switches forms, it doesn't only animate their size:

http://tech.reboot.pro/showthread.php?tid=3320
Reply
#7
Nice tutorial friend........ ;)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem in form Chuggaism 3 2,021 11-07-2013, 06:35 PM
Last Post: AceInfinity
  [VB.Net][SRC] YouTube Bot HF~Legend 5 3,658 11-25-2012, 05:54 AM
Last Post: Ixam
  Greation a promission for users in main form or setting deveco 2 1,018 11-13-2012, 01:33 PM
Last Post: TAHMINA123
  [VB.Net][SRC]ProgressBar Color HF~Legend 14 7,508 09-08-2012, 04:18 PM
Last Post: spesificrelax
  [VB.NET] Basic Reverse Connection RAT [SRC] hasam 1 3,048 02-01-2012, 03:10 PM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 2 Guest(s)