Re: A problem with GETCURSORPOS() and widescreen-monitor ?
Posted: Mon Nov 13, 2017 4:06 pm
And generic function for calculate, please test it and tell me
- Code: Select all Expand view
//----------------------------------------------------------------------------//
// Calculate nZoom and/or DPIs
Function CalcZoom( oWnd )
// { nZoom, DPIs }
Local aZooms := { { 100, 096 }, { 120, 115 }, { 125, 120 }, { 140, 134 }, ;
{ 150, 144 }, { 160, 154 }, { 180, 173 }, ;
{ 200, 192 }, { 225, 216 }, { 250, 240 }, { 300, 288 }, ;
{ 400, 384 }, { 500, 480 } }
Local nZoom
local nDPIs := 0
local nPos := 0
local hDCM := oWnd:GetDC()
local nLogX := GetDeviceCaps( hDCM, LOGPIXELSX )
local nLogY := GetDeviceCaps( hDCM, LOGPIXELSY )
nPos := AsCan( aZooms, { | a | a[ 2 ] == nLogX } )
if Empty( nPos )
// Not found in array predefined modes
nDPIs := 96 + Round( nLogX * 24 / 25, 0 )
nZoom := Round( nDPIs * 100 / 96, 0 )
else
// Found in array predefined modes
nDPis := nLogX
nZoom := aZooms[ nPos ][ 1 ]
endif
Return { nZoom, nDPIs }
//----------------------------------------------------------------------------//