[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

GDI+ DrawString space between words

Giedrius

1/7/2005 2:35:00 PM

Hi,
using DrawString, MeasureString works not as it should on my WinXP
SP2+.NET1.1 latest SP. On Win2003 works fine.
Problem is that same text in a owner drawn grid is drawn with different
spacing between words.
It looks like below (same text just first ends with 1, second ends with 12):
"Some text ver 1"
"S om e text v er ..."
Same appearance is visible on VS.Net designer where property descriptions
are shown.
After lots of testing I found, that this behaviour does not occure only if
specifying Rectangle.Width=0, however it is not acceptable.
My question, is it a problem only for me? If it is not, how it should be
resolved?
3 Answers

VisualHint

1/7/2005 3:09:00 PM

0

I also experience the same problem, but while using ellipsis with
DrawString. I am currently waiting for help in another post.

Herve

Bob Powell

1/7/2005 5:26:00 PM

0

The placement of text and inter-character spacing will depend on which
TextRenderingHint is used. There is an article in MSDN that explains why the
character spacing in GDI+ is the way it is.

http://windowsforms.net/articles/gdi...


--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Giedrius" <Giedrius@discussions.microsoft.com> wrote in message
news:B4CC2A08-169C-4E98-B9AC-B3EA27261837@microsoft.com...
> Hi,
> using DrawString, MeasureString works not as it should on my WinXP
> SP2+.NET1.1 latest SP. On Win2003 works fine.
> Problem is that same text in a owner drawn grid is drawn with different
> spacing between words.
> It looks like below (same text just first ends with 1, second ends with
> 12):
> "Some text ver 1"
> "S om e text v er ..."
> Same appearance is visible on VS.Net designer where property descriptions
> are shown.
> After lots of testing I found, that this behaviour does not occure only if
> specifying Rectangle.Width=0, however it is not acceptable.
> My question, is it a problem only for me? If it is not, how it should be
> resolved?


Giedrius

1/10/2005 10:31:00 AM

0

Thanks for your anwer.
TextRenderingHint = AntiAlias helps with correct spacing, but painted text
looks different, and not so fine as in other controls like Label, or TextBox.

Perhaps someone could provide a link or an example, of how to paint text in
specified rectangle so that character spacing would not be distorted?



"Bob Powell [MVP]" wrote:

> The placement of text and inter-character spacing will depend on which
> TextRenderingHint is used. There is an article in MSDN that explains why the
> character spacing in GDI+ is the way it is.
>
> http://windowsforms.net/articles/gdi...
>
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Giedrius" <Giedrius@discussions.microsoft.com> wrote in message
> news:B4CC2A08-169C-4E98-B9AC-B3EA27261837@microsoft.com...
> > Hi,
> > using DrawString, MeasureString works not as it should on my WinXP
> > SP2+.NET1.1 latest SP. On Win2003 works fine.
> > Problem is that same text in a owner drawn grid is drawn with different
> > spacing between words.
> > It looks like below (same text just first ends with 1, second ends with
> > 12):
> > "Some text ver 1"
> > "S om e text v er ..."
> > Same appearance is visible on VS.Net designer where property descriptions
> > are shown.
> > After lots of testing I found, that this behaviour does not occure only if
> > specifying Rectangle.Width=0, however it is not acceptable.
> > My question, is it a problem only for me? If it is not, how it should be
> > resolved?
>
>
>