|
-
April 26th, 2007, 11:21 AM
#9
Re: Help with drawing vertical text?
Your code that does the centering looks okay, and assuming that the crosshairs are centered properly when you zoom in and out, then the entire problem is most likely based around what GetTextExtent is returning. Reading the note associated with it, I would expect that, for vertically aligned texts, to have GetTextExtent return a width equal to the avg height of the characters, and a height that is equal to the true length of the text.
So it seems that GetTextExtent really returns the width and height of an enclosing rectangle that is always aligned with the x and y axis. What I would do is experiment with this. First, align your test string to the horizontal and get its true length. Also, get its TEXTMETRICS data. Then see what GetTextExtent returns when the test string is vertically aligned. Given the note associated with the function, I would expect a width that is equal to the height of the characters, and a height that is equal to the true length of the test string. If you get a value other than that, then GetTextExtent isn't working exactly as advertised (or as explained in the note). Rotate the test string to various angles (say, 15 degree increments) and observe what GetTextExtent returns. There will most likely be a pattern in the values that is trigonometric in nature. If possible, make the true length of your test string noticeably longer than the avg height of the characters.
Last edited by spiritualfields; April 26th, 2007 at 11:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|