-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathDataGridViewHeadersScaling.cs
40 lines (36 loc) · 1.46 KB
/
DataGridViewHeadersScaling.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
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace HighDpiDemo
{
public partial class DataGridViewHeadersScaling : Form
{
public DataGridViewHeadersScaling()
{
InitializeComponent();
dataGridView1.Rows[0].ErrorText = "error text";
dataGridView1.Rows.Add(new object[] { "aaa", "bbbb" });
dataGridView1.Rows.Add(new object[] { "baaa", "abbbb" });
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.RightToLeft = (dataGridView1.RightToLeft == RightToLeft.Yes ? RightToLeft.No: RightToLeft.Yes);
}
private void DataGridViewHeadersScaling_Load(object sender, EventArgs e)
{
currentDpiLabel.Text = $"Current scalling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
if (!"true".Equals(MainForm.SettingsCollection["DataGridView.DisableHighDpiImprovements"], StringComparison.InvariantCultureIgnoreCase))
{
infoLabel.Text = "Row header resizing improvement is enabled.";
}
else
{
infoLabel.Text = "Row header resizing improvement is disabled.";
}
}
private void DataGridViewHeadersScaling_DpiChanged(object sender, DpiChangedEventArgs e)
{
currentDpiLabel.Text = $"Current scalling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
}
}
}