Index: src/Common/SharpMap.UI/Forms/ToolStripSeparatorWithText.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/SharpMap.UI/Forms/ToolStripSeparatorWithText.cs (.../ToolStripSeparatorWithText.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/SharpMap.UI/Forms/ToolStripSeparatorWithText.cs (.../ToolStripSeparatorWithText.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -5,13 +5,19 @@ { public class ToolStripSeparatorWithText : ToolStripSeparator { + public override Size GetPreferredSize(Size constrainingSize) + { + var parent = Parent ?? Owner; + return new Size(parent.Width - (parent.Padding.Horizontal), Height); + } + protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var stringSize = e.Graphics.MeasureString(Text, Font); var xLoc = (float) ((e.ClipRectangle.Width/2.0) - (stringSize.Width/2.0)); - var yLoc = (float) ((e.ClipRectangle.Height / 2.0) - (stringSize.Height / 2.0)); + var yLoc = (float) ((e.ClipRectangle.Height/2.0) - (stringSize.Height/2.0)); var rectangle = new RectangleF(xLoc, yLoc, stringSize.Width, stringSize.Height); using (var solidBrush = new SolidBrush(ForeColor)) @@ -20,11 +26,5 @@ e.Graphics.DrawString(Text, Font, solidBrush, xLoc, yLoc); } } - - public override Size GetPreferredSize(Size constrainingSize) - { - var parent = Parent ?? Owner; - return new Size(parent.Width - (parent.Padding.Horizontal), Height); - } } } \ No newline at end of file