Browse Source

WordBreak

pull/3535/head
CreateAndInject 5 months ago
parent
commit
7ad382a8bd
  1. 4
      ILSpy/Controls/CustomDialog.cs

4
ILSpy/Controls/CustomDialog.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Controls
using (Graphics g = this.CreateGraphics()) using (Graphics g = this.CreateGraphics())
{ {
SizeF size = TextRenderer.MeasureText(message, label.Font, default, TextFormatFlags.NoPrefix); Size size = TextRenderer.MeasureText(message, label.Font, new((int)(Screen.FromControl(this).WorkingArea.Width * 0.9), int.MaxValue), TextFormatFlags.NoPrefix | TextFormatFlags.WordBreak);
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); 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]; Button[] buttons = new Button[buttonLabels.Length];
int[] positions = new int[buttonLabels.Length]; int[] positions = new int[buttonLabels.Length];
@ -64,7 +64,7 @@ namespace ICSharpCode.ILSpy.Controls
string buttonLabel = buttonLabels[i]; string buttonLabel = buttonLabels[i];
newButton.Text = buttonLabel; newButton.Text = buttonLabel;
newButton.Click += new EventHandler(ButtonClick); newButton.Click += new EventHandler(ButtonClick);
SizeF buttonSize = TextRenderer.MeasureText(buttonLabel, newButton.Font); Size buttonSize = TextRenderer.MeasureText(buttonLabel, newButton.Font);
newButton.Width = Math.Max(newButton.Width, ((int)Math.Ceiling(buttonSize.Width * 96 / g.DpiX / 8.0) + 1) * 8); newButton.Width = Math.Max(newButton.Width, ((int)Math.Ceiling(buttonSize.Width * 96 / g.DpiX / 8.0) + 1) * 8);
positions[i] = pos; positions[i] = pos;
buttons[i] = newButton; buttons[i] = newButton;

Loading…
Cancel
Save