Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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