D
Die_Another_Day
This is a question for all of the MVP's out there. I use this code to
get the screen size and adjust my userform to fit. Can anyone explain
why I have to multiply the returned screen size by 0.75 in order for
things to line up correctly?
Thanks,
Die_Another_Day
Option Explicit
Private Const SPI_GETWORKAREA = 48
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub SizeForm()
Dim nRect As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, nRect, 0
With UserForm1
.Top = nRect.Top
.Left = nRect.Left
.Width = (nRect.Right - nRect.Left) * 0.75
.Height = (nRect.Bottom - nRect.Top) * 0.75
End With
UserForm1.Show
End Sub
get the screen size and adjust my userform to fit. Can anyone explain
why I have to multiply the returned screen size by 0.75 in order for
things to line up correctly?
Thanks,
Die_Another_Day
Option Explicit
Private Const SPI_GETWORKAREA = 48
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub SizeForm()
Dim nRect As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, nRect, 0
With UserForm1
.Top = nRect.Top
.Left = nRect.Left
.Width = (nRect.Right - nRect.Left) * 0.75
.Height = (nRect.Bottom - nRect.Top) * 0.75
End With
UserForm1.Show
End Sub