Skip to content

Commit 9d41937

Browse files
committed
Fix high DPI scaling of custom special char tables
1 parent 7fce482 commit 9d41937

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Vocup.WinForms/Forms/SpecialCharKeyboard.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,18 @@ private void Form_Load(object sender, EventArgs e)
9797
Font = new Font("Arial", 9.75f)
9898
};
9999

100+
float factorX, factorY;
101+
using (Graphics g = CreateGraphics())
102+
{
103+
factorX = g.DpiX / 96f;
104+
factorY = g.DpiY / 96f;
105+
}
106+
100107
int index = 0;
101108
int itemsPerLine = 12;
102-
Point offset = new(8, 6);
103-
Point space = new(6, 6);
104-
Size size = new(25, 25);
109+
Point offset = new((int)(8 * factorX), (int)(6 * factorY));
110+
Point space = new((int)(6 * factorX), (int)(6 * factorY));
111+
Size size = new((int)(25 * factorX), (int)(25 * factorY));
105112

106113
while (!reader.EndOfStream)
107114
{

0 commit comments

Comments
 (0)