accurate drawn text width

  • Thread starter Thread starter Two Many
  • Start date Start date
T

Two Many

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
 
Why's MeasureString no good for you?
Keep in mind, that GetPixel call is very slow on CF.
 
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
 
Back
Top