diff --git a/ILSpy/Controls/CustomDialog.cs b/ILSpy/Controls/CustomDialog.cs index d51f69c0ff..63ca6bef9d 100644 --- a/ILSpy/Controls/CustomDialog.cs +++ b/ILSpy/Controls/CustomDialog.cs @@ -51,8 +51,8 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel using (Graphics g = this.CreateGraphics()) { - SizeF size = TextRenderer.MeasureText(message, label.Font); - Size clientSize = new Size((int)(size.Width * 96 / g.DpiX) + DockPadding.Left + DockPadding.Right, (int)(size.Height * 96 / g.DpiY) + DockPadding.Top + DockPadding.Bottom); + SizeF size = TextRenderer.MeasureText(message, label.Font, default, TextFormatFlags.NoPrefix); + Size clientSize = new Size((int)Math.Ceiling(size.Width * 96 / g.DpiX) + DockPadding.Left + DockPadding.Right, (int)Math.Ceiling(size.Height * 96 / g.DpiY) + DockPadding.Top + DockPadding.Bottom); Button[] buttons = new Button[buttonLabels.Length]; int[] positions = new int[buttonLabels.Length]; int pos = 0; @@ -86,7 +86,7 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel { clientSize.Width = pos; } - clientSize.Height += panel.Height + 6; + clientSize.Height += panel.Height; this.ClientSize = clientSize; int start = (clientSize.Width - pos) / 2; for (int i = 0; i < buttons.Length; i++)