microsoft / microsoft/WPF-Samples

PerMonitorDpi scaling

Open
#50 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5.7k
Forks
3.3k
Avg merge
12d 8h
Merged PRs (30d)
2

Description

The code for scaling fonts in a WinForms user control makes the overall size way bigger than the scaling factor. Enter a factor of 1.25, you might get 1.66 as the actual size.

Control.Scale sets the size of the child controls correctly, as per the scaling factor. However the fonts are still their original (small) size. Scaling the fonts doesn't give a correct overall ratio, and can mess up layout controls.

What's the correct way to get scaled fonts and controls to match the scalingFactor?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WinForms user control's font and Control.Scale handling, comparing the reported 1.25 scaling factor with the resulting control and font sizes. Reproduce the mismatch and trace how child controls and fonts are scaled. Done means the controls and fonts maintain the requested scaling factor without disrupting layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.