ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Screen resolutions and resizing forms (https://www.excelbanter.com/excel-programming/347902-screen-resolutions-resizing-forms.html)

Ken Soenen

Screen resolutions and resizing forms
 

Is there some software technique that could change the size of your Forms
when you run the Forms with different screen resolutions?
For example: I keep my screen at 1280x1024. When I run the form on say
1024x768, the whole form becomes unnecessarily large and may not even fit on
the screen.
At a minimum, is there some system item that indicates the current screen
resolution, that I could query, and then manually(at Form activation) change
the Form and control sizes?

Thanks



Ron de Bruin

Screen resolutions and resizing forms
 
Hi Ken

You can use this in a module

Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " & GetSystemMetrics32(1)
End Function

Then in your code you can use this

If DisplayVideoResolution = "1024 x 768" Then ......................


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ken Soenen" wrote in message ...

Is there some software technique that could change the size of your Forms when you run the Forms with different screen
resolutions?
For example: I keep my screen at 1280x1024. When I run the form on say 1024x768, the whole form becomes unnecessarily large and
may not even fit on the screen.
At a minimum, is there some system item that indicates the current screen resolution, that I could query, and then manually(at
Form activation) change the Form and control sizes?

Thanks




STEVE BELL

Screen resolutions and resizing forms
 
You might consider sizing the form to the screen size...

Here's some code Ron posted a long time ago...

'Fill the Screen
Private Sub UserForm_Initialize()
With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Hight
Me.Width = .Width
End With
End Sub

--
steveB

Remove "AYN" from email to respond
"Ken Soenen" wrote in message
...

Is there some software technique that could change the size of your Forms
when you run the Forms with different screen resolutions?
For example: I keep my screen at 1280x1024. When I run the form on say
1024x768, the whole form becomes unnecessarily large and may not even fit
on the screen.
At a minimum, is there some system item that indicates the current screen
resolution, that I could query, and then manually(at Form activation)
change the Form and control sizes?

Thanks




Tom Ogilvy

Screen resolutions and resizing forms
 
That would leave controls along the edges invisible and off the form if he
develops on 1280 by 1040 then displays it on 800 x 600 for example. then
if he gathered all the controls in the upper left corner to protect against
that, it would just look stupid in 1280 by 1040 <g

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:Mcknf.9504$Ea6.5376@trnddc08...
You might consider sizing the form to the screen size...

Here's some code Ron posted a long time ago...

'Fill the Screen
Private Sub UserForm_Initialize()
With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Hight
Me.Width = .Width
End With
End Sub

--
steveB

Remove "AYN" from email to respond
"Ken Soenen" wrote in message
...

Is there some software technique that could change the size of your

Forms
when you run the Forms with different screen resolutions?
For example: I keep my screen at 1280x1024. When I run the form on say
1024x768, the whole form becomes unnecessarily large and may not even

fit
on the screen.
At a minimum, is there some system item that indicates the current

screen
resolution, that I could query, and then manually(at Form activation)
change the Form and control sizes?

Thanks






STEVE BELL

Screen resolutions and resizing forms
 
Thanks Tom,

Didn't realize this problem...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
That would leave controls along the edges invisible and off the form if he
develops on 1280 by 1040 then displays it on 800 x 600 for example. then
if he gathered all the controls in the upper left corner to protect
against
that, it would just look stupid in 1280 by 1040 <g

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:Mcknf.9504$Ea6.5376@trnddc08...
You might consider sizing the form to the screen size...

Here's some code Ron posted a long time ago...

'Fill the Screen
Private Sub UserForm_Initialize()
With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Hight
Me.Width = .Width
End With
End Sub

--
steveB

Remove "AYN" from email to respond
"Ken Soenen" wrote in message
...

Is there some software technique that could change the size of your

Forms
when you run the Forms with different screen resolutions?
For example: I keep my screen at 1280x1024. When I run the form on say
1024x768, the whole form becomes unnecessarily large and may not even

fit
on the screen.
At a minimum, is there some system item that indicates the current

screen
resolution, that I could query, and then manually(at Form activation)
change the Form and control sizes?

Thanks








Tom Ogilvy

Screen resolutions and resizing forms
 
It isn't a problem - it is a feature. That is how you would implement a
Show Details button.

--
Regards,
Tom Ogilvy




"STEVE BELL" wrote in message
news:gAknf.9714$Ea6.4496@trnddc08...
Thanks Tom,

Didn't realize this problem...

--
steveB

Remove "AYN" from email to respond
"Tom Ogilvy" wrote in message
...
That would leave controls along the edges invisible and off the form if

he
develops on 1280 by 1040 then displays it on 800 x 600 for example.

then
if he gathered all the controls in the upper left corner to protect
against
that, it would just look stupid in 1280 by 1040 <g

--
Regards,
Tom Ogilvy

"STEVE BELL" wrote in message
news:Mcknf.9504$Ea6.5376@trnddc08...
You might consider sizing the form to the screen size...

Here's some code Ron posted a long time ago...

'Fill the Screen
Private Sub UserForm_Initialize()
With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Hight
Me.Width = .Width
End With
End Sub

--
steveB

Remove "AYN" from email to respond
"Ken Soenen" wrote in message
...

Is there some software technique that could change the size of your

Forms
when you run the Forms with different screen resolutions?
For example: I keep my screen at 1280x1024. When I run the form on

say
1024x768, the whole form becomes unnecessarily large and may not even

fit
on the screen.
At a minimum, is there some system item that indicates the current

screen
resolution, that I could query, and then manually(at Form activation)
change the Form and control sizes?

Thanks











All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com