"Kevin Provance" <> wrote ...
> Do you have Aero running? Just for kicks, try changing your Vista theme
> to
> basic, without all the flashy Aero stuff and see if the results are the
> same. I've noticed some oddities with the GDI based API with Aero
> running,
> and there may well be another incompatibility.
Hi Dave and Kevin,
I suspect Kev is right.
My first reaction to David's post was "he's gotta be smoking crack!" :-) But
I tried a quick repro, using plain C code (to avoid any VB weirdness) and I
got the same result! The string of centred text was skewed towards the right
margin of the window. This only occurs when I add SetTextCharacterExtra()
with a parameter > 0 ... DrawText() on its own, appears to work okay, as
does SetTextCharacterExtra(hdc, 0);
It worked correctly on an XP machine - the text was centrred in the window.
However, after I tried turning off Aero by using a Windows Basic theme, I
still saw the distortion in the centred text. It looks like even if Aero is
not active, there is some kind of distortion going on. There appear to be
several such issues floating around, in developer forums.
It's not a big problem for C code because you have much more fine-grained
control over the appearance, using DRAWTEXTPARAMS and the like. I'm pretty
sure a call to ExtTextOut would work instead. But I'm not sure how one might
do that from VB. You could report the issue to Microsoft; but I have to say,
I think fixing it will be a very low priority for them. DrawText is largely
superceded in C/C++ code by more Unicode-friedly functions; and
SetTextCharacterExtra() is already officially deprected for XP - see
http://support.microsoft.com/kb/305320
If I get any extra insights I'll report them back here.
--
Andrew McLaren
amclar (at) optusnet dot com dot au