PC Review


Reply
Thread Tools Rate Thread

accurate drawn text width

 
 
Two Many
Guest
Posts: n/a
 
      15th Feb 2004
Use MeasureString, right? Nope, I need to find out the exact width of
drawn text. I am thinking of inspecting pixels to find where the text
starts and ends. I would start to scan vertically from the far left
and move right until I hit a colored pixel and this would be the
start. Then, I would scan vertically from the far right and move left
until I hit a colored pixel and this would be the end. Thus,
end-start = exact drawn width. This is the best that I could think
of... unless somebody has a better solution????

-
TM
 
Reply With Quote
 
 
 
 
Alex Yakhnin, MVP
Guest
Posts: n/a
 
      15th Feb 2004

Why's MeasureString no good for you?
Keep in mind, that GetPixel call is very slow on CF.

--
Alex Yakhnin, NET CF MVP
IntelliProg, Inc.
http://www.intelliprog.com

"Two Many" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Use MeasureString, right? Nope, I need to find out the exact width of
> drawn text. I am thinking of inspecting pixels to find where the text
> starts and ends. I would start to scan vertically from the far left
> and move right until I hit a colored pixel and this would be the
> start. Then, I would scan vertically from the far right and move left
> until I hit a colored pixel and this would be the end. Thus,
> end-start = exact drawn width. This is the best that I could think
> of... unless somebody has a better solution????
>
> -
> TM



 
Reply With Quote
 
Two Many
Guest
Posts: n/a
 
      16th Feb 2004
MeasureString is not accurate and it doesn't do exactly what I want.
I have seen MeasureString returning widths less than what was drawn!
Anyway, I need to know the exact number of pixels wide the text was
drawn. The scanning method seems like the only solution for me at the
moment.

-
TM

"Alex Yakhnin, MVP" <(E-Mail Removed)> wrote in message news:<Ors$#(E-Mail Removed)>...
> Why's MeasureString no good for you?
> Keep in mind, that GetPixel call is very slow on CF.
>
> --
> Alex Yakhnin, NET CF MVP
> IntelliProg, Inc.
> http://www.intelliprog.com
>
> "Two Many" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Use MeasureString, right? Nope, I need to find out the exact width of
> > drawn text. I am thinking of inspecting pixels to find where the text
> > starts and ends. I would start to scan vertically from the far left
> > and move right until I hit a colored pixel and this would be the
> > start. Then, I would scan vertically from the far right and move left
> > until I hit a colored pixel and this would be the end. Thus,
> > end-start = exact drawn width. This is the best that I could think
> > of... unless somebody has a better solution????
> >
> > -
> > TM

 
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
Panel.Width not accurate during runtime Paulem0071 Microsoft Outlook Program Addins 0 19th Sep 2008 03:49 PM
Re: text boxes drawn objects do not appear on chart Jon Peltier Microsoft Excel Charting 0 12th Dec 2006 10:38 PM
Can a cell's text order be ahead of a drawn item? xcelentform Microsoft Excel Misc 0 26th Jul 2006 06:21 PM
Can a cell's text order be ahead of a drawn item? xcelentform Microsoft Excel Misc 0 26th Jul 2006 05:32 PM
Text in owner drawn list disapear ! Yair Cohen Microsoft VB .NET 0 13th Jan 2004 07:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:07 PM.