Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2004

Tip: Looking for answers? Try searching our database.

funny working ListBox or a bug in VS 6.0 ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JAGELLO - 31 May 2004 00:16 GMT
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!
David Lowndes - 01 Jun 2004 15:30 GMT
>!!!!!!!!! BUT !!!!!!!!!
>If I set that font right in my ListBox and want to have the text added with code :
[quoted text clipped - 4 lines]
>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

The symptoms you describe typically happen when you've destroyed the
font - the font needs to exist for the lifetime it's used, which
generally means that you need to have the CFont object as a member
variable of the dialog that uses the listbox control.

Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.