Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to make forms adjust to different video resolutions automatically?

0 views
Skip to first unread message

L. J. Klinsky

unread,
Sep 27, 1999, 3:00:00 AM9/27/99
to
Hi all. Does anyone know of a way to make forms automatically center and
size themselves on different people's monitors? My app looks great at 800 x
600, but it is off center and too big at 640 x 480, too small and off
center at 1024 x 768.

Leslee


Peter Hughes

unread,
Sep 27, 1999, 3:00:00 AM9/27/99
to
You need to use the form's Resize event to write your own code to handle
this, making use of the Screen object's .Width and .Height properties and
then sizing the components on your form to fit the (maximised, I presume)
layout.

There are third-party controls that tend to be called "elastics", and these
can handle some or all of the resizing for you, but I don't know any more
than that, sorry

HTH
--
Peter Hughes
L. J. Klinsky wrote in message
<7snpa2$jdq$1...@birch.prod.itd.earthlink.net>...

Abdul-Rahman

unread,
Sep 27, 1999, 3:00:00 AM9/27/99
to
I accually just learnet to do just that..

that is to change screen resolutions from VB on Runtime.. when the
application is running. Then with you end the application, it automatically
changes back the resolution to the default.


let me know if you need the code

abdul

Gordon Macfarlane

unread,
Sep 28, 1999, 3:00:00 AM9/28/99
to
Ya, send the code as I would like to see the process as well.

Gordon

Abdul-Rahman <abdul...@yahoo.com> wrote in article
<7so81b$a21$1...@nclient5-gui.server.ntli.net>...

Abdul-Rahman

unread,
Sep 28, 1999, 3:00:00 AM9/28/99
to
okay sure,


Enter the following in the general declarations area of a fourm


Option Explicit
Private Declare Function EnumDisplaySettings Lib "user32" Alias
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As
Long, lpDevMode As Any) As Boolean
Private Declare Function ChangeDisplaySettings Lib "user32" Alias
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long


Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000

Private Type DEVMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Dim DevM As DEVMODE

Then

Enter this code in a command button (etc..)

Dim a As Boolean
Dim i&
i = 0
Do
a = EnumDisplaySettings(0&, i&, DevM)
i = i + 1
Loop Until (a = False)
Dim b&
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth = 640
DevM.dmPelsHeight = 480
b = ChangeDisplaySettings(DevM, 0)

this will set reolution to 640X480. You can change that to 800X600 by
altering the above code.


Regards,
Abdul


Gordon Macfarlane wrote in message <01bf0944$bf5666c0$2430bfce@gords>...

Andrew Groat

unread,
Sep 28, 1999, 3:00:00 AM9/28/99
to
Hi Leslee

I have just downlaoded and tested an OCX control called msResize - it is
shareware.

Its great - you just put the control on the form (it is invisible) and all
the controls on the form shrink or stretch according to the Forms resizing
and also according to screen resolution.

There are other controls available like this... I tried a few but this was
by far the easiest.

I will email you a copy.

Cheers.......Andrew - Australia

L. J. Klinsky <ljkl...@earthlink.net> wrote in message
news:7snpa2$jdq$1...@birch.prod.itd.earthlink.net...

Jason Thompson

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
The third party control I use is Sheridan's vsElastic control. It works really
good. Also, you can set registry settings so that each time the application is
launched you check the PC's resolution and then based on your registry settings
set the forms size and placement.
0 new messages