• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

load a form full screen / dead center



how can i load my form to be
a) full screen and filling all the corners,(dead center)
by that i mean i dont have to move it up and left to fill

the screen, and no part is on the far right past the screen.

b) load my normal form, (size is smaller than the full

screen) dead center.

c) can i load it like this when i debug?
0
jxharding
Asked:
jxharding
1 Solution
 
R_RajeshCommented:
Hi jxharding,

Private Sub Form_Load()
'set the startup position to center screen in form properties
Me.Width = Screen.Width
Me.Height = Screen.Height
End Sub



Cheers!

Rajesh
0
 
R_RajeshCommented:
also you might want to set the windowstate to maximized in form properties
0
 
dbrckoviCommented:
If you use R_Rajesh's method, then add:

Me.Top = 1
Me.Left = 1

To place your form where it is supposed to be.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
dbrckoviCommented:
Sorry R_Rajesh.

I wasn't paying attention to    >>   'set the startup position to center screen in form properties
0
 
EDDYKTCommented:
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48

Private Type RECT
   Left As Long
   Top As Long
   Right As Long
   Bottom As Long
End Type

Private rc As RECT

Private Sub Form_Load()
SystemParametersInfo SPI_GETWORKAREA, vbNull, rc, 0
Me.Move rc.Left * Screen.TwipsPerPixelX, rc.Top * _
           Screen.TwipsPerPixelY, rc.Right * _
           Screen.TwipsPerPixelX, rc.Bottom * _
           Screen.TwipsPerPixelY
End Sub
0
 
learning_t0_pr0gramCommented:
do you even need code for that? just change (in the properties for the form) WindowState to Maximized, BorderStyle to None, and Startup in the center of the screen
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now