From 70b35b408efab8c9735c592d6198cefd763062dd Mon Sep 17 00:00:00 2001 From: Jordi Mas i Hernandez Date: Tue, 22 Jun 2004 16:40:48 +0000 Subject: [PATCH] MeasureString wrappers svn path=/trunk/mcs/; revision=30127 --- .../System.Drawing/System.Drawing/ChangeLog | 4 ++++ .../System.Drawing/System.Drawing/Graphics.cs | 21 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog index c2e7d4415a5..b8ecebd61c1 100644 --- a/mcs/class/System.Drawing/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog @@ -1,3 +1,7 @@ +2004-06-22 Jordi Mas i Hernandez + + * Graphics.cs: added MeasureString wrappers + 2004-06-22 Jordi Mas i Hernandez * Graphics.cs, gdipFunctions.cs: define and use GdipSetVisibleClip_linux diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs index b5caaed7c44..54c750c03ff 100755 --- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs @@ -1441,10 +1441,19 @@ namespace System.Drawing return new SizeF(boundingBox.Width, boundingBox.Height); } - [MonoTODO] + public SizeF MeasureString (string text, Font font, int width) - { - throw new NotImplementedException (); + { + RectangleF boundingBox = new RectangleF (); + RectangleF rect = new RectangleF (0, 0, width, 999999); + int charactersFitted, linesFilled; + + Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, + font.NativeObject, ref rect, IntPtr.Zero, + out boundingBox, out charactersFitted, out linesFilled); + GDIPlus.CheckStatus (status); + + return new SizeF (boundingBox.Width, boundingBox.Height); } @@ -1454,10 +1463,12 @@ namespace System.Drawing return MeasureString (text, font, layoutArea, stringFormat, out charactersFitted, out linesFilled); } - [MonoTODO] + public SizeF MeasureString (string text, Font font, int width, StringFormat format) { - throw new NotImplementedException (); + int charactersFitted, linesFilled; + return MeasureString (text, font, new SizeF (width, 999999), + format, out charactersFitted, out linesFilled); } -- 2.25.1