When you do a clean installation of Windows 7 or 8, you will have set the system-font-size set to medium (125%) by default. Because of this I set the height of a TextField-control to 25, which is 22 by default.
When you do a clean installation of Windows 10, or even an upgrade of the above mentioned Win7/8, you end up having the default system-fontsize set to 100%. This is ok to me, but I find my application not nice looking since my textfields should be set to height = 22 again.
To have this generic solved, I think about having a containercontrol holding a label and a textfield inside which resizes / reposition automatically.
Beside this, the proportions of objects is completely different in Windows 10 so you have to reposition thing to keep everything nice looking.
Curious how other Windows developers deal with this.
Soft Declare Function SetProcessDPIAware Lib "user32" () As Boolean
and using fixed sizes and letting some extra space left so that at least 100% and 125% both work fine. Everything beyond this? Well I do not have any customer using 150%… and I hope I won’t get one
And until Xojo does not support HiDPI through the framework (e.g. in toolbars) you have to switch to 3rd Party components.
of course, that’s correct that’s why I mentioned “3rd party components”
and this is the reason why I’ve bought your uncrypted license… I am following the strict policy not to use anything uncrypted in my software (esp. in software for my key “bread-and-butter” customers)
Seems I have the uncrypted Rubberviews license twice (to keep Michel happy) and will try to implement it in a Windows project later. Features first … to keep my “bread-and-butter” customer happy too.
one last thing Joost… if you’re using any canvas in your HiDPI’ed Apps, dont forget to check scaling factor … this snipped is valid for Windows only, you have to try… catch and set pragmas if used multiplatform.
function ScalingFactor as Single
Try
Soft Declare Function GetDC Lib "user32" (hWnd As Ptr) As Ptr
Soft Declare Function GetDeviceCaps Lib "gdi32" (hdc As Ptr, nIndex As Integer) As Integer
Soft Declare Sub ReleaseDC Lib "user32" (hWnd As Ptr, hdc As Ptr)
Const LOGPIXELSX = 88
Const LOGPIXELSY = 90
Dim hdc As Ptr = GetDC(Nil)
Dim dpiX As Integer = GetDeviceCaps(hdc, LOGPIXELSX)
Dim dpiY As Integer = GetDeviceCaps(hdc, LOGPIXELSY)
ReleaseDC(Nil, hdc)
Dim scaleFactorX As Double = dpiX / 96
Dim scaleFactorY As Double = dpiY / 96
Return scaleFactorX
Catch
Return 1
Finally
end Try
end function
and this should stay in the .Paint Event of your canvas
If ScalingFactor > 1 Then
g.DrawPicture(HiresImage, 0, 0, g.Width, g.Height, 0, 0, HiresImage.Width, HiresImage.Height)
Else
g.DrawPicture(NormalImage, 0, 0)
End If
and of course this should be revalidated/ rechecked if the window is moved in multi-display enviroments (PC with one HiDPI display, one 2nd non-HiDPI display)
Thanks a lot Tomas.
I do use CANVAS in my application many times and was just looking for this.
This should has been a part of the framework for RAD shouldn’t it ?