VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Want to move and resize form in as the program start up?..here's a simple an valuable code..very si

by Renato Gesulga (Hindang, Leyte) (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th December 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Want to move and resize form in as the program start up?..here's a simple an valuable code..very simple yet appropriate code..try this on your

Rate Want to move and resize form in as the program start up?..here's a simple an valuable code..very si



@@Address: Hindang, Leyte, Philippines
@@email: [email protected]
Mobile #: +639104534819
@@Course: BS Information Technology
@@School: MLG COLLEGE OF LEARNING
@@School Address: Brgy. Atabay, Hilongos, Leyte, Philippines

'first you need to have 4 timer control, and each timer had a code for you.. snippets it...ok?..enjoy surfing the code...


Private Sub Form_Load()
'hide the form so that the form will start from left to right
'because we set up the form to be load from left not by screen to appear
Main.Hide 'hide the form so that the form will start at left side going right
Timer1.Interval = 1000 'setting timer1 interval
Call move_form 'calling sub procedure move_form
      
     Main.Top = 4000 'setting form's center as the program run
End Sub


Private Sub Timer1_Timer()
Dim a As Integer, b As Integer
a = 1
b = 1
 ' below code emphasize on how the formsize(width and height ascend using for next loop in timer
   For a = 1 To 4170 Step 1
      Main.Width = a
    
     If Main.Width = 4170 Then
      Exit For
      End If
    Next
    
   For b = 1 To 4000 Step 1
   Main.Height = b
   
   If Main.Height = 4000 Then
   
   Exit For
   End If
   Next
    Timer1.Enabled = False
  Timer1.Interval = 0
  Exit Sub
 
End Sub

Private Sub Timer2_Timer()
Dim answer As Integer, a As Integer, b As Integer
a = Main.ScaleWidth
b = Main.ScaleHeight

 Main.Show
 ' below code demonstrate on how the form decrease in size
 'furthermore it is the reverse code for timer1
If Main.Height = 4000 Then
 For b = 4000 To 1 Step -1
   Main.Height = b
   
  
   Next
 End If
 
 If Main.Width = 4170 Then
   For a = 4170 To 1 Step -1
      Main.Width = a
    
    Next
   End If
   
 Timer4.Interval = 1000
   Timer4.Enabled = True
   
End Sub

Private Sub endprog()
End
End Sub

Private Sub move_form()
Timer3.Interval = 1000
Timer3.Enabled = True
End Sub

Private Sub Timer3_Timer()
Dim a As Integer, b As Integer
Dim x As Integer, y As Integer

 'below code demonstrate the start up form moving from left to right as it run program
 Me.Show
y = ((Screen.Width - 5000) - Main.Width) / 2
a = 1
For a = 1 To y Step 30
  Main.Left = a
    a = a + 1
Next
 
   
Timer3.Enabled = False
Timer3.Interval = 0

 
Exit Sub
End Sub

Private Sub Timer4_Timer()
'below is the reverse code for timer3
Dim a As Integer, b As Integer
Dim x As Integer, y As Integer
'show the form
 Main.Show
 'enable the timer4, because i disable it form such call of timer
 Timer4.Enabled = True
 'get the width of screen and main form for it,we have to subtract to get the value of "a"
 x = ((Screen.Width - 5000) - Main.Width) / 2
a = -2445
'looping till b = a, set to form on how it move on screen while program is running
  
  For b = x To a Step -1
   'this code move the form to left, back where it was start when the program start up
    Main.Left = b
   b = b - 8
     
    ' call sub name endprog if b=a
   If b = a Then
    Call endprog
    End If
   
  Next b
 
    'kill the timer4 process
Timer4.Enabled = False
Timer4.Interval = 0
  Exit Sub
Exit Sub
 
End Sub

Private Sub cmdExit_Click()
 Timer2.Interval = 1000
  
End Sub


Download this snippet    Add to My Saved Code

Want to move and resize form in as the program start up?..here's a simple an valuable code..very si Comments

No comments have been posted about Want to move and resize form in as the program start up?..here's a simple an valuable code..very si. Why not be the first to post a comment about Want to move and resize form in as the program start up?..here's a simple an valuable code..very si.

Post your comment

Subject:
Message:
0/1000 characters