How to get the Windows Size (Screen Size) 
Author Message
 How to get the Windows Size (Screen Size)

Hello:

    How to get the screen size Height and Width ?

    I need to centrate a windows in the screen.

                                        thanks in adnvace
                                                            Jorge
V.S.'980219

--
////////////////////////////////////////////////////////////////////////

//  ALEF DATA S.A.  //
//  Fn:(562) 695-6600  //  Jorge Valenzuela Sepulveda
//  Fx:(562) 697-2037  //  Jefe Area Soporte Tecnico

//  Santiago, Chile  //
///////////////////////////////////////////////////////////////////////



Mon, 07 Aug 2000 03:00:00 GMT  
 How to get the Windows Size (Screen Size)

Use the Screen Object:

Screen.Height
Screen.Width

To center form:

Private Sub Form_Load()

Me.Top = (Screen.Height -Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2

End Sub

Good Luck,

Chat
VB Developer for PC Scale

"Genius's and Fools, were all alike under God's eyes." - Unk
Msgbox "Now is a good time to PANIC!",  vbCritical, "Oops..." - Standard Error
Handler Message



Mon, 07 Aug 2000 03:00:00 GMT  
 How to get the Windows Size (Screen Size)

To get screen height/width use something like
    Y=Screen.Height
    X=Screen.Width
If you want that in pixels use
    X = Screen.Width / Screen.TwipsPerPixelX
    Y = Screen.Height / Screen.TwipsPerPixelY

--
Talen Lorn's Eclectic Pagan Page
http://www.geocities.com/Athens/Acropolis/8466/index.html



Tue, 08 Aug 2000 03:00:00 GMT  
 How to get the Windows Size (Screen Size)

In VB 4 or 5 use the Screen Object.

I.e. .... lngWidth = Screen.Width or lngHeight = Screen.Height

Center the form with the following:

In VB 5 set the form's start-up location property to centered.
In VB 4 ...

Me.Top = ((Screen.Height / Screen.TwipsPerPixelY) \ 2) - Me.Height
Me.Left = ((Screen.Width / Screen.TwipsPerPixelX) \ 2) - Me.Width

--

Tony Selke

(please remove the _No-Junk-Mail_ prior to responding)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Quote:
>    How to get the screen size Height and Width ?

>    I need to centrate a windows in the screen.



Tue, 08 Aug 2000 03:00:00 GMT  
 How to get the Windows Size (Screen Size)

Quote:

> In VB 4 or 5 use the Screen Object.

> I.e. .... lngWidth = Screen.Width or lngHeight = Screen.Height

> Center the form with the following:

> In VB 5 set the form's start-up location property to centered.
> In VB 4 ...

> Me.Top = ((Screen.Height / Screen.TwipsPerPixelY) \ 2) - Me.Height
> Me.Left = ((Screen.Width / Screen.TwipsPerPixelX) \ 2) - Me.Width

> --

> Tony Selke

> (please remove the _No-Junk-Mail_ prior to responding)

> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

> >    How to get the screen size Height and Width ?

> >    I need to centrate a windows in the screen.

This might be easier:

frmYourform.Top = (Screen.Height - frmYourform.Height) / 2
frmYourform.Left = (Screen.Width - frmYourform.Width) / 2

This will center the form on any size monitor screen. (I believe
anyway).

Regards,

--

Richard Knechtel
EDS
(Systems Engineer/System Administrator)
(Aspiring AS/400 GURU)
(Aspiring Linux GURU)

       The contents of this message express only MY opinion.
       This message does not necessarily reflect the policy or views of
       my employer, EDS.  All responsibility for the statements
       made in this posting resides solely and completely with the
       ME.
       I Ex-Spaminate spammers!
       See US Code Title 47, Sec.227(a)(2)(B), Sec.227(b)(1)(C)
       and Sec.227(b)(3)(C).



Tue, 15 Aug 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. API to return screen size, resolutions, and font size

2. Best way to size a form to different screen sizes

3. Windows Display Font Sizes Vs. Application Font Sizes

4. Getting screen size of a string

5. Getting Screen Size

6. CommandBar Size, CommandBarMenuBar Size and CommandBarMenuBarItem Size.

7. Adjust program with many screen size of windows

8. Getting Disk Allocation Unit Size in VB5 on Windows 95 OSR2

9. Page size for the background= Page size of the first page of the drawing

10. Size Word window for different monitor sizes and resolutions

11. Actual spool size vs. document size

12. Form Size and different sized monitors in VB4.0

 

 
Powered by phpBB® Forum Software