mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Fix menu renderer.
This commit is contained in:
parent
2bd4a815d3
commit
39d3579e27
1 changed files with 16 additions and 5 deletions
|
@ -71,17 +71,28 @@ namespace ShiftOS.WinForms.Tools
|
|||
e.TextColor = LoadedSkin.Menu_TextColor;
|
||||
}
|
||||
}
|
||||
e.TextRectangle = GenRect(e.Text, e.TextFont, e.Item.Size, e.Graphics);
|
||||
e.TextRectangle = GenRect(e.Text, e.TextFont, e.Item.Size, e.Graphics, e.TextRectangle);
|
||||
base.OnRenderItemText(e);
|
||||
}
|
||||
|
||||
private Rectangle GenRect(string t, Font f, Size s, Graphics g)
|
||||
private Rectangle GenRect(string t, Font f, Size s, Graphics g, Rectangle rekt)
|
||||
{
|
||||
|
||||
Rectangle rect = new Rectangle();
|
||||
var fSize = g.MeasureString(t, f);
|
||||
var loc = new Point((s.Width - (int)fSize.Width) / 2, (s.Height - (int)fSize.Height) / 2);
|
||||
var rSize = new Size(loc.X + (int)fSize.Width, loc.Y + (int)fSize.Height);
|
||||
rect = new Rectangle(loc, rSize);
|
||||
int width = rekt.Left + (int)fSize.Width;
|
||||
int height = rekt.Top + (int)fSize.Height;
|
||||
|
||||
int rwidth = rekt.Left + rekt.Width;
|
||||
int rheight = rekt.Top + rekt.Height;
|
||||
|
||||
int wDiff = (width - rwidth);
|
||||
int hDiff = (height - rheight);
|
||||
|
||||
rect = new Rectangle(rekt.Left, rekt.Top, rekt.Width + wDiff, rekt.Height + hDiff);
|
||||
|
||||
|
||||
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue