Application.AllowHiDPI

From Xojo Documentation

Design Property (as Boolean)
This Application property can only be set in the Inspector and is not available in code.

You can only set this property in the Inspector for the App object. Set to ON to make the app HiDPI-aware. This is set to True by default.

Notes

You can read this property at run-time:

If App.AllowHiDPI Then
// HiDPI is enabled
Else
// HiDPI is not enabled
End If

When AllowHiDPI is turned OFF, the framework will continue to work the way it did before. Images that use @2x or @3x in the name will have their PPI (points per inch) adjusted accordingly (144ppi, 216ppi).

You can turn the AllowHiDPI property on or off dynamically by using an IDE Script. This turns it on:

PropertyValue("App.AllowHiDPI") = "True"

Use the text "False" to turn it off.

When AllowHiDPI is turned ON, the framework will NOT change the ppi when an image with @2x or @3x in its name is loaded. It is up to you to set the PPI (which is most easily handled using an Image Set). The reason for this is so that if you need access to the image's original PPI, you'll be able to get it by manually loading the image and setting is PPI.

If you want to set the PPI automatically based on its name, you can use this method:

Sub SetImageResolutionFromName(p As Picture, filename As String)
Var r As New RegEx
r.SearchPattern = "@([0-9.]+)x\."

Var rm As RegExMatch = r.Search(filename)
If rm <> Nil And rm.SubExpressionCount > 0 Then
Var n As Double = CDbl(rm.SubExpressionString(1))
p.HorizontalResolution = 72 * n
p.VerticalResolution = 72 * n
End If
End Sub