Re: funny working ListBox or a bug in VS 6.0 ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jeff Partch [MVP] (jeffp_at_mvps.org)
Date: 05/30/04


Date: Sun, 30 May 2004 18:30:48 -0500


"jagello" <jagello7@hotmail.com> wrote in message
news:4391E70A-D9C4-4C3C-A742-013E4B1D3DCE@microsoft.com...
> Hi!
>
> I have a problem with setting the character set in my ListBox (List). When
I create a CFont object with a specific character set and I set that font in
the Device Context recieved from the ListBox, then it is OK. I can write
through that DC in the chosen charset. See Code :
>
> CFont * font = new CFont;
> CFont *oldFont;
> CPaintDC dc( List );
> font->CreateFont (28,0,0,0,700,0,0,0,
> RUSSIAN_CHARSET,OUT_DEFAULT_PRECIS,
> CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
> DEFAULT_PITCH|FF_DONTCARE, "Arial");
> oldFont = dc.SelectObject( font);
> dc.ExtTextOut(10,170,0,
> NULL,"some text",
> strlen("some text"),NULL);
>
> !!!!!!!!! BUT !!!!!!!!!
> If I set that font right in my ListBox and want to have the text added
with code :
>
> List->SetFont( font, TRUE);
> List->AddString( "some other text" );
>
> in the chosen charset, then it DOES NOT work !
> However the added text has the other parameters of the chosen font (
Height and so on) but the charset is the original (standard) one
> Does anyone know how to force the ListBox to accept the charset from the
font also ? Or it might be a bug in my Visual Studio ?
> PLEASE HELP!
>

I'm pretty certain it's not a bug in your Visual Studio, but otherwise I'm
not sure. In the above you do a 'new CFont'. When do you do the 'delete
CFont' ?

-- 
Jeff Partch [VC++ MVP]


Relevant Pages

  • funny working ListBox - help!
    ... I have a problem with setting the character set in my ListBox. ... I can write through that DC in the chosen charset. ... If I set that font right in my ListBox and want to have the text added ...
    (comp.lang.cpp)
  • Re: funny working ListBox or a bug in VS 6.0 ?
    ... I presume you are showing the code from your DrawItem handler. ... why you do 'new CFont' and not just declare a CFont variable (instead of a CFont * ... If it is a listbox with an edit control, and not a DropList style, then doing this drawing ... handler comes with the font preset in the DC, so there would be no need to set it again. ...
    (microsoft.public.vc.mfc)
  • Re: funny working ListBox - help!
    ... jagello wrote: ... > I have a problem with setting the character set in my ListBox. ... > When I create a CFont object with a specific character set and I set ...
    (comp.lang.cpp)