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 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...
How to Run a Visual Basic Program on a PC
Select "Windows Application" in the "Visual Basic Projects" folder ... Visual Basic program in its simplest form. ... from the .NET framework......
How to Add a Scroll Bar to Visual Basic
... especially when you have users with lower screen resolution. ... up and down or left to right on a Graphical User...
How to Resize a Web Page to Fit the Screen Size
How to Resize a Web Page to Fit the Screen Size. ... How to Make a Form Fit Any Size Screen of...
Visual Basic: How to Set an Image Array to a Picture
Visual Basic: How to Set an Image Array to a Picture. Images help to make any computer program stand out. ... How...
How to Change the Default Internet Explorer Window Size
How to Change the Screen Size in Windows Vista. Changing the screen size in Windows Vista is really about changing the resolution.
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 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...