Skip to content

System font scaling - scale controls with explicitly specified font #3263

Description

@kirsan31

Currently only controls with default fonts will be scaled with system font change. We need to auto scale controls with explicitly specified font too.
More info in these comments #3263 (comment) #3263 (comment) and this draft PR.

Initial suggestion: Ability to set relative Font size and style **Is your feature request related to a problem? Please describe.**

Many new Fonts for the controls are simple size/style change of parent font. Currently you can achieve this in Designer only by explicitly creating new fixed Font object. But this is completely breaks Windows Font size scaling of your app. So, for now to preserve Font size scaling you need (full manual approach not a variant here):

Design form in designer (with creating fixed fonts) and then in constructor reassign fonts to all needed controls like:

control.Font = new Font(control.Parent.Font.FontFamily, control.Parent.Font.SizeInPoints * 1.1f, FontStyle.Bold);
// or
control.Font = new Font(DefaultFont, FontStyle.Bold);
// or
control.Font = SomePredefinedFont;

Drawbacks:

  • If you have complex form with many controls, manual assigning fonts is hard and boring.
  • Designer creates many Fonts instances, that will be replaced on form creation anyway.

Describe the solution you'd like and alternatives you've considered

Ability to set font size/style of the control in designer relative to Parent/Default font.
Sorry, but I can't suggest designer user input interface for this - many options are possible ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestion(1) Early API idea and discussion, it is NOT ready for implementationarea-HDPIHDPI, not specific to Dpi mode of appon-hold

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions