How RFgen Scales App Forms
This topic describes how RFgen scales the Form Display on physical devices and provides more details on the Display: ScaleMode properties.
The Display > ScaleMode allows the developer two options: Form Scaling and DPI Scaling.
Form Scaling scales the size of the form in the designer to the actual (physical) screen dimensions.
- It uses the size in the form and scales to the NEAREST physical edges of the device.
- The shortest distance is used first and then the longer side is scaled proportionally.
- Once the form is sized, this the AutoSize property is considered to then change the form accordingly. (Then anchoring….)
- It also finalizes the scale, child object sizes/placement using AutoSize, Anchor and Docking properties.
Form Scaling Example
- The Dev Studio form display = 192 x 320 pixels (2.0 inches by 3.33 inches).
- The Dev Studio form orientation = portrait.
- The Dev Studio form Display = AutoSize = Screen
- The actual device’s display = 1280 x 720 pixels (8 inches x 7-1/2 inches).
- The actual devices orientation is irrelevant as RFgen adjusts if the device is rotated.
The application uses the nearest edge of the actual display, in this case, the 7-1/2 inch side, then scales the form proportionally to the other edge which is the 8-inch side. Then it refines the portions based on the value in the AutoSize property and other settings such as Anchor settings.
Note: If AutoSize = (None), then the form on the actual device will have the same size/ scaling as the form in Dev Studio. (It disables ScaleMode.)
DPI Scaling renders the display on the physical device using the dpi on the form in the designer, and scales to the contents on the form using the resolution of the physical device.
DPI Scaling Example
- The Dev Studio form display= 96 dpi.
- The actual device (i.e. tablet) = 160 dpi.
Since 160 is 1.67 the resolution of 96 dpi, the objects in the application will be rendered at a scale of roughly at 1.67 on the actual device if the form’s Autosize setting = Screen, Width, or Height.
If the form’s AutoSize property = (None), then the form would maintain the same scaling as set in the designer. (It uses less real estate on the actual device.)
The docking and anchoring values are also based on the results of the AutoSize.