[Mono-list] MeasureString

Charlie Poole charlie at nunit.com
Thu Sep 20 17:19:39 EDT 2007


In spite of its problems, I've used MeasureString pretty successfully,
provided I stick to the more common fonts. IF the result is "way off", make
sure you are using the same options with MeasureString that you ultimately
use to display the text.
 
Charlie


  _____  

From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Maser, Dan
Sent: Thursday, September 20, 2007 2:03 PM
To: Jansen Bart; mono-list at lists.ximian.com
Subject: Re: [Mono-list] MeasureString


 
  It might be a real issue, but my app has the need to measure strings too
and I've found that MeasureString is often quite wrong.  The MSDN docs
indicate that it often is too, and recommends using
Graphics.MeasureCharacterRanges instead.   You might consider trying that
approach as a work-around.   I know that I've removed all references to
MeasureString in my app in favor of MeasureCharacterRanges which is far more
reliable for me.

  _____  

From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Jansen Bart
Sent: Thursday, September 20, 2007 3:28 PM
To: mono-list at lists.ximian.com
Subject: [Mono-list] MeasureString



Hi all,

 

I'm trying to ensure that a string fits in a rectangle shown on screen, so
whenever the string is too long, some characters are stripped.  I'm using
MeasureString to accomplish this.  With mono under windows this is working
fine, under linux the resulting string is always way too long.  Is this a
known issue? Is there a workaround?

 

Thanks a lot for your help,

 

B.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070920/edc7e0ec/attachment.html 


More information about the Mono-list mailing list