PC Review


Reply
 
 
Caeb
Guest
Posts: n/a
 
      3rd May 2004
Hi, Trying to figure something out with Font widths, Measure String,
and DrawString.

In the OnPaint event I have something like this.

e.Graphics.DrawString("Testing 123", this.Font, Brushes.Blue,0,0);

e.Graphics.DrawString("Testing ", this.Font, Brushes.Red, 0,
this.Font.Height * 2);

float lw = e.Graphics.MeasureString("Testing ", this.Font, 5000, new
StringFormat(StringFormatFlags.MeasureTrailingSpaces)).Width;

e.Graphics.DrawString("123", this.Font, Brushes.Green, lw,
this.Font.Height * 2);

Ok, Everythign works fine but the 123 on the second line doesnt start
where the 123 on the first line does, it starts to far to the right.
(NOT SURE IF THE FORMATTIGN WILL MESS UP) e.g.
Testing 123
Testing 123

Questions.
1) What's going on here?
2) I noticed that DrawString doesnt start drawing on the left most
pixel when setting float x to 0 in drawstring function, why is
this?

Thanks, For any help

Caeb

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to set DPI for DrawString? Mark B Microsoft ASP .NET 1 14th Aug 2009 11:25 PM
DrawString Rlrcstr Microsoft VB .NET 2 29th May 2005 05:46 PM
Bug in GDI+ DrawString Brian Smith Microsoft Dot NET Framework 5 22nd Oct 2004 08:29 AM
Re: DrawString Robert Misiak Microsoft C# .NET 3 13th Jul 2004 02:44 AM
gdi+ drawstring jack Microsoft VB .NET 5 13th Nov 2003 12:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:21 AM.