DrawText

This content has moved to another location. See DrawText for the latest version.

Tags :


Community Content

SteelBytes
DrawText and TextOut are sensitive to memory aligment when drawing to a DIBSection

DrawTextW on 2000 and XP will not render to a DIBSection if the string is not WCHAR aligned in memory. But it does work in Vista.
TextOutW will not render to a DIBSection when the string is non WCHAR aligned on any of 2000, XP or Vista.
Both DrawTextW and TextOutW work find when drawing to either a screen DC or a printer DC on all three Windows flavours.

see http://louis.steelbytes.com/DrawTextBug.html for more info

Tags :

Patillo
Get the Text's Bounding RECT
Using the DT_CALCRECT flag will result in the text's bounding rect being stored in the lprect parameter of DrawText. The actual location of the left, top, right and bottom are stored. The function does not store the actual dimensions.

Note that using DT_CALCRECT will not draw the text, so a subsequent call to DrawText is required.


Tags :

Vlad VIssoultchev
DT_MODIFYSTRING on Vista
It seems that on Vista DT_MODIFYSTRING no longer modifies lpchText past the end of the string (zero terminator) so previous documentation about modifing +4 characters is no longer valid.

The result is that the appended ellipses at the end of the string might be less than 3 although 3 ellipses get painted on the DC.

Tip: Combine DT_MODIFYSTRING and DT_CALCRECT to prevent painting but get the string modified.

cheers,
</wqw>
Tags :

Page view tracker