SCALEFACTOR property

Windows

The work needed to accommodate per-monitor DPI scaling in Windows 8.1 has also created the ability to scale OpenInsight forms to an arbitrary value outside of any system DPI settings. This new functionality is exposed via the SCALEFACTOR property.

This WINDOW property is a dynamic array comprising four fields:

FieldValueDescription
<1>ScaleFactorThis is a number that specifies how much to scale the form by. A value of 1 means that the form has no scaling applied, a value of 1.5 scales the form to on-and-a-half times its normal size and so on.

Note that the scale factor is applied after any scaling applied for system DPI. So, if your form runs on a 144 DPI monitor (150%) and has a scalefactor of 2 applied the actual scalefactor used is 3.0 (1.5 x 2.0).
<2>Minimum ScaleFactorThis specifies the minimum value that the ScaleFactor can be set to. By default it is set to "0.1". This value can be set at design time. See the note on "Scaling Restrictions" below.
<3>Maximum ScaleFactorThis specifies the maximum value that the ScaleFactor can be set to. By default it is set to "5.0". This value can be set at design time. See the note on "Scaling Restrictions" below.
<4>ScaleFactor IncrementIf this field is set to a value other than 0 it allows the ScaleFactor to be adjusted via the Mouse-wheel / Ctrl-key combination, or with a "pinch-zoom" gesture if running under a touch screen. The increment value controls the rate at which the form grows or shrinks. This value can be set at design time.

#1: Set a form's scale to twice its designed size while allowing the user to adjust the scalefactor by the mouse or touchscreen.

* // Note that we ignore the min and max scalefactors, leaving them at their

* // defaults.

scaleFactor = ""

ScaleFactor<1> = 2     ; * // twice normal size

SacleFactor<4> = 0.1  ; * // allow mousewheel/gesture - each wheel notch

                                  ; * // adjusts the scalefactor by 0.1

The minimum and maximum size that a form can be rescaled to can be restricted by the minimum and maximum window sizes as defined by the OS. As a general rule this size is usually slightly larger than the size of the entire desktop across all monitors (See the GetSystemMetrics() Windows API function along with the indexes SM_CXMAXTRACK, SM_CXMINTRACK, SM_CYMAXTRACK, and SM_CYMINTRACK for more details).

You can, however, override this behavior if you set the TRACKINGSIZE property for a form, specifying values large enough to handle your desired scaling range.

* // Example - Ensure the form will actually scale to the min and max factors

* //                 we have set.

 

winSize         = get_Property( @window, "SIZE" )

scaleFactor    = get_Property( @window, "SCALEFACTOR" )

 

trackingSize       = ""

trackingSize<1> = winSize<3> * scaleFactor<2>

trackingSize<2> = winSize<4> * scaleFactor<2>

trackingSize<3> = winSize<3> * scaleFactor<3>

trackingSize<4> = winSize<4> * scaleFactor<3>

 

call set_Property( @window, "TRACKINGSIZE", trackingSize )
  • guides/programming/programmers_reference_manual/scalefactor.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1