Screen to adapt to user resolution 
Author Message
 Screen to adapt to user resolution

Hi

Does anyone know how to get my program to adapt to different resolutions,
for example: I wrote my program in 800X600, but I want it to works on a
laptop also.

How can I make it get those settings and then adapting accordingly ?


Thank you in advance

Johann Joubert
South Africa



Fri, 27 Aug 1999 03:00:00 GMT  
 Screen to adapt to user resolution

Quote:

> Hi

> Does anyone know how to get my program to adapt to different resolutions,
> for example: I wrote my program in 800X600, but I want it to works on a
> laptop also.

> How can I make it get those settings and then adapting accordingly ?


> Thank you in advance

> Johann Joubert
> South Africa

Yes.  Use the API!  I just figured this out and had to use it myself!

1) put the following in your declarations section:

Declare Function GetSystemMetrics Lib "User" (ByVal nIndex As Integer)
As Integer

' GetSystemMetrics() codes
Global Const SM_CXSCREEN = 0
Global Const SM_CYSCREEN = 1
Global Const SM_CXVSCROLL = 2
Global Const SM_CYHSCROLL = 3
Global Const SM_CYCAPTION = 4
Global Const SM_CXBORDER = 5
Global Const SM_CYBORDER = 6
Global Const SM_CXDLGFRAME = 7
Global Const SM_CYDLGFRAME = 8
Global Const SM_CYVTHUMB = 9
Global Const SM_CXHTHUMB = 10
Global Const SM_CXICON = 11
Global Const SM_CYICON = 12
Global Const SM_CXCURSOR = 13
Global Const SM_CYCURSOR = 14
Global Const SM_CYMENU = 15
Global Const SM_CXFULLSCREEN = 16
Global Const SM_CYFULLSCREEN = 17
Global Const SM_CYKANJIWINDOW = 18
Global Const SM_MOUSEPRESENT = 19
Global Const SM_CYVSCROLL = 20
Global Const SM_CXHSCROLL = 21
Global Const SM_DEBUG = 22
Global Const SM_SWAPBUTTON = 23
Global Const SM_RESERVED1 = 24
Global Const SM_RESERVED2 = 25
Global Const SM_RESERVED3 = 26
Global Const SM_RESERVED4 = 27
Global Const SM_CXMIN = 28
Global Const SM_CYMIN = 29
Global Const SM_CXSIZE = 30
Global Const SM_CYSIZE = 31
Global Const SM_CXFRAME = 32
Global Const SM_CYFRAME = 33
Global Const SM_CXMINTRACK = 34
Global Const SM_CYMINTRACK = 35
Global Const SM_CMETRICS = 36

2) Use the following function to determine screen size:

    Temp% = GetSystemMetrics(SM_CXFRAME)    '<--Sizable Border size
    Temp2% = GetSystemMetrics(SM_CYCAPTION) '<--Form Caption Height
    Temp3% = GetSystemMetrics(SM_CYMENU)    '<--Height of menu (if used)
    Temp4% = GetSystemMetrics(SM_CXSCREEN)  '<--Screen Horizontal Pixels
    Temp5% = GetSystemMetrics(SM_CYSCREEN)  '<--Screen Vertical Pixels

    MsgBox "Screen is " & Str$(Temp4%) & " Pixels wide and " &
Str$(Temp5%) & " Pixels high."

Hope this helps.

Jon Upham, California
--
__www.cris.com\~uphamjk___
|      _______   _   _   |
|     /______/  // _//   |
|       //     //_//     |
|   _  //  &  /_ /       |
|  //_//     // \\       |
| /___/ on  //   \\ athy |
|________________________|



Fri, 27 Aug 1999 03:00:00 GMT  
 Screen to adapt to user resolution


GMT):

Quote:
>Does anyone know how to get my program to adapt to different resolutions,
>for example: I wrote my program in 800X600, but I want it to works on a
>laptop also.

No problem. Develop in the smallest resolution you want to
offer (will be 640*480 I'd say).

Then put code in your form's form_resize-event to place and
size all controls relative to the absolute sizes of your
form.

Your form's sizes are:

Me.Width
Me.Height

Mathias Schiffer, Germany



Sat, 28 Aug 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Adapting To Different Screen Resolutions?

2. User forms and screen resolutions

3. Determining user's screen resolution at runtime

4. Adjust forms to users' screen resolution

5. Screen resolution most users use...

6. User′s screen resolution

7. How do I determine a users screen resolution

8. Changing screen resolution in full-screen programs?

9. Changing screen resolution in full-screen programs?

10. Screen coordinates change after changing screen resolution???

11. How to Change Screen Resolution in VBA

12. Screen resolution problem

 

 
Powered by phpBB® Forum Software