Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's discussed in general he
https://www.informit.com/articles/ar...&seqNum=2&rl=1 -- Regards, Tom Ogilvy "Die_Another_Day" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom! Keep smoking that good stuff you got over there!!
Die_Another_Day "Tom Ogilvy" wrote in message ... It's discussed in general he https://www.informit.com/articles/ar...&seqNum=2&rl=1 -- Regards, Tom Ogilvy "Die_Another_Day" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
LARGE | Excel Worksheet Functions | |||
LARGE 1, LARGE 2, LARGE 3, LARGE 4 | Excel Worksheet Functions | |||
IF Function too Large | Excel Discussion (Misc queries) | |||
LARGE | Excel Programming | |||
Sub too large | Excel Programming |