Visual Basic 6 is a programming language for Windows. The programmer draws controls like buttons and text boxes on a "form" (the VB6 term for a window). A form normally scales with the screen resolution, which means it will take up a larger portion of a low-resolution screen.
Sometimes you want a form to fit itself to the screen so that it fills the screen and looks the same at any resolution. This is particularly common with entertainment and presentation software.
Set the form's WindowState property to 2 (Maximized). This makes the form fill the screen when the program runs.
Set the form's BorderStyle property to 0 (None). This makes the form stretch to the edges of the screen instead of displaying a title bar and the Windows Taskbar.
Arrange the form's controls in its Resize event. This allows you to place the controls in the same relative position no matter what the form's actual size is. For example, this code moves a command button to the center of the form:
Private Sub Form_Resize()
Command1.Left = (Me.ScaleWidth - Command1.Width) / 2
Command1.Top = (Me.ScaleHeight - Command1.Height) / 2
- "Microsoft Visual Basic 6.0 Language Reference"; Maureen Williams Zimmerman; 1998
How to Run a Visual Basic Program on a PC
Like C++, C Sharp and Java, Visual Basic (VB) is an object oriented programming language. Recently it was integrated to the Microsoft...
How to Display Message in Visual Basic
Visual Basic is a good computer language for beginners. Not only does it have an easy syntax to understand, but Visual Basic...
How to Create an Installer For Your VB6 Program
Once you have finished designing, coding and testing your Visual Basic program, you will need a way to distribute the application to...
How to Add a Scroll Bar to Visual Basic
It's good to know how to enable scroll bars in your Microsoft Visual Basic.NET (VB.NET ) application, especially when you have users...
Visual Basic: How to Set an Image Array to a Picture
Images help to make any computer program stand out. Whether you design a card game or a photo album or even a...
How to Resize a Visual Basic Form to Fit the Screen
When you design a form in Visual Basic, you decide upon an ideal size and build the form accordingly. Unless you restrict...