forked from microsoft/dotnet-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
62 lines (53 loc) · 1.89 KB
/
MainForm.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Drawing;
using System.Windows.Forms;
namespace PerMonitorDemo
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void showLayoutButton_Click(object sender, EventArgs e)
{
(new SimpleLayout()).Show();
}
// Install targeting pack from the appropriate build
// \\vsufile\patches\sign\NETFX\4.7\S112.2\02032.00\MTPack\NDP463-TargetingPack-KB3183844.exe
private void MainForm_Load(object sender, EventArgs e)
{
NameValueCollection settingsCollection = null;
try
{
settingsCollection = ConfigurationManager.GetSection("System.Windows.Forms.ApplicationConfigurationSection") as NameValueCollection;
}
catch
{
}
if (settingsCollection != null)
{
dpiAwarenessLabel.Text = $"Application DPI Awareness is {settingsCollection.Get("DpiAwareness")}.";
}
formSizeLabel.Text = $"Form size is {Size.Width.ToString()} x {Size.Height.ToString()}";
}
private void MainForm_SizeChanged(object sender, EventArgs e)
{
formSizeLabel.Text = $"Form size is {Size.Width.ToString()} x {Size.Height.ToString()}";
}
private void formSizeTextBox_DpiChangedAfterParent(object sender, EventArgs e)
{
formSizeLabel.Text = $"Form size is {Size.Width.ToString()} x {Size.Height.ToString()}";
}
private void customDrawing_Click(object sender, EventArgs e)
{
(new CustomDrawing()).Show();
}
private void buttonImages_Click(object sender, EventArgs e)
{
(new ScaleButtonImages()).Show();
}
}
}