Skip to content

Commit 762a771

Browse files
Fix high Dpi
1 parent 9986104 commit 762a771

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ILSpy/Controls/CustomDialog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel
5353
{
5454
Rectangle screen = Screen.PrimaryScreen.WorkingArea;
5555
SizeF size = g.MeasureString(message, label.Font, screen.Width - 20);
56-
Size clientSize = size.ToSize();
56+
Size clientSize = new Size((int)(size.Width * 96 / g.DpiX), (int)(size.Height * 96 / g.DpiY));
5757
Button[] buttons = new Button[buttonLabels.Length];
5858
int[] positions = new int[buttonLabels.Length];
5959
int pos = 0;
@@ -66,7 +66,7 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel
6666
newButton.Text = buttonLabel;
6767
newButton.Click += new EventHandler(ButtonClick);
6868
SizeF buttonSize = g.MeasureString(buttonLabel, newButton.Font);
69-
newButton.Width = Math.Max(newButton.Width, ((int)Math.Ceiling(buttonSize.Width / 8.0) + 1) * 8);
69+
newButton.Width = Math.Max(newButton.Width, ((int)Math.Ceiling(buttonSize.Width * 96 / g.DpiX / 8.0) + 1) * 8);
7070
positions[i] = pos;
7171
buttons[i] = newButton;
7272
pos += newButton.Width + 4;

0 commit comments

Comments
 (0)