forked from microsoft/dotnet-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRightAnchor.cs
30 lines (26 loc) · 991 Bytes
/
RightAnchor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Windows.Forms;
namespace HighDpiDemo
{
public partial class RightAnchor : Form
{
public RightAnchor()
{
InitializeComponent();
}
private void RightAnchor_Load(object sender, EventArgs e)
{
currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
if (MainForm.SettingsCollection != null)
{
string value = MainForm.SettingsCollection.Get("AnchorLayout.DisableHighDpiImprovements");
bool enabled = !string.Equals("true", value, StringComparison.InvariantCultureIgnoreCase);
label2.Text = "Re-scaling fix is " + (enabled ? "enabled" : "disabled");
}
}
private void RightAnchor_DpiChanged(object sender, DpiChangedEventArgs e)
{
currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
}
}
}