Author: jpobst
Date: 2007-07-18 15:33:51 -0400 (Wed, 18 Jul 2007)
New Revision: 82233
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs
Log:
2007-07-18 Jonathan Pobst <[EMAIL PROTECTED]>
* TextRenderer.cs: Use the static Graphics context in Hwnd instead
of creating one for measuring strings.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-07-18 19:31:35 UTC (rev 82232)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-07-18 19:33:51 UTC (rev 82233)
@@ -1,5 +1,10 @@
2007-07-18 Jonathan Pobst <[EMAIL PROTECTED]>
+ * TextRenderer.cs: Use the static Graphics context in Hwnd instead
+ of creating one for measuring strings.
+
+2007-07-18 Jonathan Pobst <[EMAIL PROTECTED]>
+
* ToolStrip.cs, ToolStripDropDown.cs, ToolStripDropDownMenu.cs:
Implement MaxItemSize.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs
2007-07-18 19:31:35 UTC (rev 82232)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs
2007-07-18 19:33:51 UTC (rev 82233)
@@ -38,8 +38,6 @@
#endif
class TextRenderer
{
- private static Bitmap measure_bitmap = new Bitmap (1, 1);
-
private TextRenderer ()
{
}
@@ -88,7 +86,7 @@
public static Size MeasureText (string text, Font font)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, Size.Empty, TextFormatFlags.Default, false);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
Size.Empty, TextFormatFlags.Default, false);
}
public static Size MeasureText (IDeviceContext dc, string text,
Font font)
@@ -98,7 +96,7 @@
public static Size MeasureText (string text, Font font, Size
proposedSize)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, proposedSize, TextFormatFlags.Default, false);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
proposedSize, TextFormatFlags.Default, false);
}
public static Size MeasureText (IDeviceContext dc, string text,
Font font, Size proposedSize)
@@ -108,7 +106,7 @@
public static Size MeasureText (string text, Font font, Size
proposedSize, TextFormatFlags flags)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, proposedSize, flags, false);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
proposedSize, flags, false);
}
public static Size MeasureText (IDeviceContext dc, string text,
Font font, Size proposedSize, TextFormatFlags flags)
@@ -265,10 +263,9 @@
}
else {
#endif
- Graphics g = Graphics.FromImage
(measure_bitmap);
StringFormat sf = FlagsToStringFormat (flags);
- Size retval = g.MeasureString (text, font,
Int32.MaxValue, sf).ToSize ();
+ Size retval = Hwnd.bmp_g.MeasureString (text,
font, Int32.MaxValue, sf).ToSize ();
if (retval.Width > 0 && (flags &
TextFormatFlags.NoPadding) == 0)
retval.Width += 9;
@@ -317,7 +314,7 @@
internal static Size MeasureTextInternal (string text, Font
font, bool useMeasureString)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, Size.Empty, TextFormatFlags.Default,
useMeasureString);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
Size.Empty, TextFormatFlags.Default, useMeasureString);
}
#if NET_2_0
@@ -334,7 +331,7 @@
internal static Size MeasureTextInternal (string text, Font
font, Size proposedSize, bool useMeasureString)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, proposedSize, TextFormatFlags.Default,
useMeasureString);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
proposedSize, TextFormatFlags.Default, useMeasureString);
}
internal static Size MeasureTextInternal (IDeviceContext dc,
string text, Font font, Size proposedSize, bool useMeasureString)
@@ -345,7 +342,7 @@
#endif
internal static Size MeasureTextInternal (string text, Font
font, Size proposedSize, TextFormatFlags flags, bool useMeasureString)
{
- return MeasureTextInternal (Graphics.FromImage
(measure_bitmap), text, font, proposedSize, flags, useMeasureString);
+ return MeasureTextInternal (Hwnd.bmp_g, text, font,
proposedSize, flags, useMeasureString);
}
#endregion
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches