Re: GDI+ Error Messages?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



If the MSDN says it can be "1" for a Zero-terminated string, they should
correct it. This usually is "-1" in that case.

Christian

"Larry Lindstrom" <nobody@xxxxxxxxxxx> wrote in message
news:CPSdnSEagIq6RIPbnZ2dnUVZ_j6dnZ2d@xxxxxxxxxxxxxx
Michael Phillips, Jr. wrote:
How do I get GDI+ to be more specific about the problem?
lastResult InvalidParameter


It looks like it was very specific. One of the parameters that you
passed
as an argument is not correct!

graphics.DrawString(display_text, -1<---------------------The MSDN
documentation states that this may be set to 1 if the display_text
string
is null terminated,
alphabet_tab_record_ptr->get_font(),
gdi_plus_rc_f, &string_format, &text_brush);

Thanks Michael:

Changing that didn't fix the problem.

Does that strike you as a weird parameter? What if the user wants to
pass a single character that isn't zero terminated? The argument is
INT, which should allow negative numbers if needed.

Anyway, after changing the argument to "1", an error occurred at the
same point.

I created a new font, for testing, with:

FontFamily test_fontFamily(L"Arial");
Font test_font(&test_fontFamily, 16, FontStyleRegular,
UnitPixel);

and passed this test font to DrawString().

That worked.

The font I've been using, the one in the alphabet_tab_record_ptr,
is created during the dialog proc's WM_INITDIALOG processing. An
HFONT has been captured in the WM_SETFONT trap and the GDI+ font
in *alphabet_tab_record_ptr is constructed with

Font(hdc, hfont)

This works for one template, but not the other.

Just found it!!!!

The template's font for the tab that worked is Arial. The one that
doesn't work uses the default MS Sans Serif font. After changing the
template to to Arial everything works.

I've been bit on the *** before when using the default font with
GDI+, I think I couldn't get a height.

Is there documentation describing the fonts that work with gdi+?

I appreciate your advice Michael:

Thanks
Larry


.


Quantcast