hi.
the question is regarding an example drom the platformSDK (using keyboard input)
Quote// Calculate the maximum width of a line
dwLineLen = dwClientX - dwCharX;
dwClientX is the width of the client area
dwCharX is the average text width
so how does that calculation give you the line length ?
line length would be the width of the client area itself right ?
& dwCharX is just like the width of 1 character or something.
ty
~~
That line doesn't seem to make much sense :dazzled:
For any font, you can get information including the average character width (usually it's just the width of the character 'x').
Given the average character width you can find out how wide N characters would be (avgCharWidth * numChars), or the number of characters that will fit into a specific width (clientWidth / avgCharWidth) -- with the division truncating (ignore the remainder.)
Monospace fonts have all characters the same width, but for variable width fonts it provides a quick guess which is usually close enough.
hi Tedd,
yah what yuo said makes sense....
The excerpt is from the last example in the 'Using Keyboard Input' section
Windows User Interface-->User Input-->Keyboard Input->Keyboard Input Overviews-->Using Keyboard Input
Thanks!