-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathMultipleScalingPasses.cs
36 lines (32 loc) · 1.35 KB
/
MultipleScalingPasses.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
31
32
33
34
35
36
using System;
using System.Windows.Forms;
namespace HighDpiDemo
{
public partial class MultipleScalingPasses : Form
{
public MultipleScalingPasses()
{
InitializeComponent();
}
private void MultipleScalingPasses_Load(object sender, EventArgs e)
{
currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
listBoxSizeLabel.Text = $"Height of the ListBox = {listBox1.Size.Height}";
if (MainForm.SettingsCollection != null)
{
string value = MainForm.SettingsCollection.Get("Form.DisableSinglePassScalingOfDpiForms");
bool enabled = !string.Equals("true", value, StringComparison.InvariantCultureIgnoreCase);
label2.Text = "Re-scaling fix is " + (enabled ? "enabled" : "disabled");
}
}
private void listBox1_SizeChanged(object sender, EventArgs e)
{
listBoxSizeLabel.Text = $"Height of the ListBox = {listBox1.Size.Height}";
}
private void MultipleScalingPasses_DpiChanged(object sender, DpiChangedEventArgs e)
{
currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
listBoxSizeLabel.Text = $"Height of the ListBox = {listBox1.Size.Height}";
}
}
}