Skip to content

SP5: Improve DPI scaling support for all controls #2760

@swharden

Description

@swharden

DPI scaling support can be achieved by detecting the current scale factor (this method is specific to each control) then assigning the plot's scale factor inside the Reset() method of that control.

Example (WinForms)

I recently added display scaling support to the WinForms control like this:

public Plot Reset()
{
using Graphics gfx = CreateGraphics();
const int DEFAULT_DPI = 96;
float scaleFactor = gfx.DpiX / DEFAULT_DPI;
Plot newPlot = new()
{
FigureBackground = this.BackColor.ToColor(),
ScaleFactor = scaleFactor
};
return Reset(newPlot);
}

Updated Controls

Additional effort is required to determine how to detect DPI scale on the other controls and make this similar modification:

Community Support

I don't intend to focus on this in the short term, but if someone figures out how to calculate display scaling in one or more of the unsupported controls, I welcome a pull request! 🚀

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions