A Cool Form Scroller

By | 2002-06-01

A really cool code that will first – make the form expand down, then second – it will expand out sideways! No need to customize it to the size you want, it does that automatically. Just pop it in your code. Really easy – good beginner’s code!

Original Author: thuggish_187

Assumptions

Put a timer(Timer1) on the form… that’s it.

Code

Dim frmHeight As Integer
Dim frmWidth As Integer
Private Sub Form_Load()
Timer1.Interval = 1
frmHeight = Form1.Height
frmWidth = Form1.Width
Form1.Height = 100
Form1.Width = 100
End Sub
Private Sub Timer1_Timer()
While Form1.Height < frmHeight
Form1.Height = Form1.Height + 8
Wend
While Form1.Width < frmWidth
Form1.Width = Form1.Width + 8
Wend
Timer1.Enabled = False
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.