VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Scroll a menu from inside a form.

by Michel Chekrallah (2 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 22nd September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Scroll a menu from inside a form.

Rate Scroll a menu from inside a form.




'Create a form with a picture box
'draw a second picture inside the first one
'do not use the dblclick to paste the second picture
'create a timer, set  Interval : 1 
'                     Enabled  : Flase   
'Create 2 CommandButton

'Enjoy the Scrolling AMIGO

Sub SizePosition()
'setting the width of picture1 and picture2
Picture1.Width = 0
Picture2.Width = 2500

'setting the height of picture1 and picture2
Picture1.Height = 1800
Picture2.Height = 1800

'setting the top of picture2
Picture2.Top = 0

'setting the left of picture2 to minus it's width
Picture2.Left = -Picture2.Width

'setting the visibility of picture1 to false
Picture1.Visible = False

End Sub

Private Sub Command1_Click()
Picture1.Visible = True
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Call SizePosition
End Sub

Private Sub Form_Load()
'setting the default size and position of picture1
Call SizePosition
End Sub

Private Sub Timer1_Timer()
'scrolling the Menu
If Picture2.Left < -200 Then 'you can use a number <0 but > -500
    Picture1.Width = Picture1.Width + 500
    Picture2.Left = Picture2.Left + 500
Else
    Timer1.Enabled = False
End If
End Sub


Download this snippet    Add to My Saved Code

Scroll a menu from inside a form. Comments

No comments have been posted about Scroll a menu from inside a form.. Why not be the first to post a comment about Scroll a menu from inside a form..

Post your comment

Subject:
Message:
0/1000 characters