Detecting the settings is one thing, but resizing forms, controls, objects
and so on is not necessarily possible, realizing a logical inch in small
fonts is still a logical inch in large fonts. Therefore, if your form,
control, object is sized to a logical inch, then it should be sized that way
regardless of the dpi that has been set. In other words, a rectangle that
is a logical inch wide (set by the value returned from GetDeviceCaps(hDC,
LOGPIXELSX)) in small fonts will be the equivalent in large fonts, though
120 pixels wide rather than 96 pixels wide. For text formatting, this is,
unfortunately, not the case. If the boundry (a rectangle with a width of a
logical inch) of your text (font: Microsoft Sans Serif-8pt), when designed
in small fonts, is tight to the edge of the last character, in large fonts
it will unlikely fit. If it was designed in large fonts, it is likely that
there is undesired space between the edge of the rectangle and the last
character. Sorry for the long winded detail, but I am getting to my
point... If you take a line of text containing 13 capital letter-S
characters (Microsoft Sans Serif-8pt), in small fonts, the string width will
be 91 pixels (five short of a logical inch). In large fonts, the string
width is 117 pixels (three short of a logical inch). So...
...and finally, the question is, how do you format and/or output your text
so that these differences are taken into account? Microsoft Word does it.
When I output my text (of the above example) it is exactly 7 pixels per
character, equallying a string width of 91. In Microsoft Word, the same
text and font has a width of 94 pixels (or thereabouts). Starting from
about the fifth character onwords, it seems that the text shifts slightly to
the right, as if one or more character columns (extents) are larger. In
large fonts, Microsoft Word displays the same text and font slightly smaller
than the one I have outputted. Basically, I am lost! I can't find anything
that will give me a hint on how to deal with this difference. I've used the
example of Microsoft Sans Serif-8pt because it displays the most visible
difference, but this problem is evident with all fonts and various sizes.
What I am looking for is away to get my text string to display as closely
(closer than I have been able to achieve) to the size (extent) in any dpi.
Any help would be greatly appreciated.
Thanks in advance,