Skip to content

Commit 7ad382a

Browse files
WordBreak
1 parent e3b1eb8 commit 7ad382a

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
@@ -51,7 +51,7 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel
5151

5252
using (Graphics g = this.CreateGraphics())
5353
{
54-
SizeF size = TextRenderer.MeasureText(message, label.Font, default, TextFormatFlags.NoPrefix);
54+
Size size = TextRenderer.MeasureText(message, label.Font, new((int)(Screen.FromControl(this).WorkingArea.Width * 0.9), int.MaxValue), TextFormatFlags.NoPrefix | TextFormatFlags.WordBreak);
5555
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);
5656
Button[] buttons = new Button[buttonLabels.Length];
5757
int[] positions = new int[buttonLabels.Length];
@@ -64,7 +64,7 @@ public CustomDialog(string caption, string message, int acceptButton, int cancel
6464
string buttonLabel = buttonLabels[i];
6565
newButton.Text = buttonLabel;
6666
newButton.Click += new EventHandler(ButtonClick);
67-
SizeF buttonSize = TextRenderer.MeasureText(buttonLabel, newButton.Font);
67+
Size buttonSize = TextRenderer.MeasureText(buttonLabel, newButton.Font);
6868
newButton.Width = Math.Max(newButton.Width, ((int)Math.Ceiling(buttonSize.Width * 96 / g.DpiX / 8.0) + 1) * 8);
6969
positions[i] = pos;
7070
buttons[i] = newButton;

0 commit comments

Comments
 (0)