Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

ExplodeForm - Show a form with an explode effect

Total Hit ( 1841)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

' Show a form with an explosion effect.
' the lNumSteps parameter is the number of steps to increase the form size from
' 0 to the original size
' the lStepDuration argument is the number of milliseconds between each step

' Example:
'  Private Sub Form_Load()
'    ExplodeForm Me, 20, 2
'  End Sub

Sub ExplodeForm(frm As Form, Optional ByVal lNumSteps As Long = 25, _
  Optional ByVal lStepDuration As Long)
  Dim sngLeft As Single, sngTop As Single
  Dim sngHeight As Single, sngWidth As Single
  Dim sngNewHeight As Single, sngNewWidth As Single
  Dim sngHeightStep As Single, sngWidthStep As Single
  Dim iStep As Long
  
  On Error Resume Next
 
  'exit if the form is minimized/maximized
  If frm.WindowState <> vbNormal Then Exit Sub
  
  'save current size and position
  sngLeft = frm.Left
  sngTop = frm.Top
  sngHeight = frm.Height
  sngWidth = frm.Width
  
  'calc the step for the height/width increase
  sngHeightStep = sngHeight / lNumSteps
  sngWidthStep = sngWidth / lNumSteps
  
  'resize the form in several steps
  For iStep = 1 To lNumSteps
    'calc the new height/width
    sngNewHeight = sngNewHeight + sngHeightStep
    sngNewWidth = sngNewWidth + sngWidthStep
    ' display the form
    frm.Move sngLeft + (sngWidth - sngNewWidth) / 2, _
      sngTop + (sngHeight - sngNewHeight) / 2, sngNewWidth, sngNewHeight
    frm.Visible = True
    frm.Refresh
    ' pause if so requested
    Sleep lStepDuration
  Next
  
  ' ensure that the form is completely visible
  frm.Move sngLeft, sngTop, sngWidth, sngHeight
  
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.