BaseFormAutoScaleFont Property
Gets or sets whether the
Font should be automatically scaled when DPI changes and the current thread has per-monitor DPI awareness.
Default value:
.
Namespace: KGySoft.WinForms.FormsAssembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
[DefaultValueAttribute(true)]
public bool AutoScaleFont { get; set; }
<DefaultValueAttribute(true)>
Public Property AutoScaleFont As Boolean
Get
Set
public:
[DefaultValueAttribute(true)]
property bool AutoScaleFont {
bool get ();
void set (bool value);
}
[<DefaultValueAttribute(true)>]
member AutoScaleFont : bool with get, set
Property Value
Boolean When , the Font is automatically scaled to the current DPI of the corresponding display on every executing platform.
If this is an MDI child form, it also ensures that without an explicitly set font it is inherited from Parent, which would be the normal behavior, but is broken in .NET 6+ and above.
When , the Font may or may not be scaled, and the font of a possible parent MDI container
may or may not be applied correctly, depending on the default behavior of the executing platform.
Please note that this property directly affects autoscaling the
Font property only. It still may indirectly affect scaling
the whole form and its contents, if the
AutoScaleMode property is
Font.
Scaling the size on DPI change can also be controlled by the
DeviceScaleGetNewSize event,
or can be adjusted by handling the
DeviceScaleChanged or
DeviceScaleAutoResized events.