Discussion:
GdipDrawString returns a 'GenericError' status - What now ?
(too old to reply)
R.Wieser
2019-06-10 15:15:26 UTC
Permalink
Hello all,

I'm trying to draw some text on a GdipGraphics context. Both drawing a line
and ellipsoid works fine. The problem is drawing a bit of text on it.

The preceeding GdipCreateFontFamilyFromName and GdipCreateFont seem to
function (status is Zero), even though both return the same handle value.
GdipCreateSolidFill also seems to function (status is Zero).

The rectangle contains four 32-bit floats, the left and top zero, width and
height 50.0 (also tried a few different numbers).

The string-drawing call looks as follows:

call GdipDrawString, [hGdipGraphicsContext], offset WTXT_Test, -1,
[hGdipFont], offset [rRectF], 0, [hGdipBrush]

The resulting status is 0x1, a 'Generic Error'. And I have got zero idea
why, or how to progress.

Help ?

Regards,
Rudy Wieser
R.Wieser
2019-06-10 15:44:42 UTC
Permalink
Post by R.Wieser
The preceeding GdipCreateFontFamilyFromName and GdipCreateFont seem to
function (status is Zero), even though both return the same handle value.
Apologies, the values are in fact different. By one (hexadecimal)digit, the
third from the right.

Regards,
Rudy Wieser
R.Wieser
2019-06-12 07:50:36 UTC
Permalink
FYI,

This morning while (again) googeling for example code I stumbled over a post
of back in '12 from someone (as it turns out) having the exact same issue.

The problem was with the GdiCreateFont call. I gave it a font-size
argument as an integer, where it expected it as a float.

No idea why it was happy to create (I assume) a zero-sized font though (due
to an illegal float value), and continued as if everything was hunky-dory.
:-(

Regards,
Rudy Wieser

Loading...