Solved

Font For List Control

Posted on 2004-10-08
9
159 Views
Last Modified: 2013-12-03
Hi
     I make a MFC( Unicode) application which support two languages English and Chinese.
 There is a dialog box in my application. There is a List Control on this dialog box. Since it's an Unicode application, the font for dialog box is "MS Shell Dlg". There are some labels on dialog box and at run time some strings are insert in List Control (like its columns etc.). All these strings are picked from String Table resource. I'm executing my program on OS(en-us), but through Regional Setting, Chinese language is select.
 My problem is, when i execute program in English then no problem at all. All strings in List Control displayed properly. But when i execute program in Chinese, Then all  strings on dialog box displayed correctly but strings in List Control(like Column name etc.) don't display correctly. Is this problem due to default font of List Control or any other reason? If due to default font then please tell how to select the font for this List Control, what is a procedure? Or any other reason then please tell how to solve it?

  Thanks
0
Comment
Question by:ManojKrChauhan
  • 4
  • 4
9 Comments
 
LVL 6

Expert Comment

by:nabehs
ID: 12269403
1. Open the .rc file in text mode
2. Search for LANGUAGE attribute
3. Change to: LANGUAGE 0x04
4. Search for #pragma code_page
5. Change to #pragma code_page(936)

It should do it for resources.

Also to change the font of the dialog:

1. Open the dialog resource
2. Right Click - Select Properties
3. In the General Tab, click the Font button and set the font for the dialog

Hope this helps
0
 

Author Comment

by:ManojKrChauhan
ID: 12273928
Thanks but i said there is no problem with dialog box. The font for dialog box is MS Shell Dlg. All strings(english and chinese) on dialog box displayed correctly. and for chinese language, i already done its settings.like code page 936 etc. This is not my query. Actually, there is a list control on dialog box. At run time, i insert columns in this list control.I pick these column names from String Table resource.For english language, columns name in English.And for chinese,they are in chinese. when my program run in english language,everything displayed properly but when i run in chinese language then columns of list control don't display properly. because default font for list control is MS Sans Serif. I think it should be MS Shell Dlg. So please tell, how to set it.
 Thanks
0
 
LVL 6

Expert Comment

by:nabehs
ID: 12273989
to set the dialog font:

1. Open the dialog resource
2. Right Click - Select Properties
3. In the General Tab, click the Font button and set the font for the dialog

0
 

Author Comment

by:ManojKrChauhan
ID: 12274749
Sir
I'm not talking about dialog box. I have no problem with dialog box. I'm talking about ListControl which is on dialog box. I have problem with ListControl. I already select "MS Shell Dlg" font for dialog box. So please tell me how to solve the problem with ListControl.
 Thanks
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:nabehs
ID: 12274788
sorry for my misunderstanding, you can change the font of the list control by the following:

// assume the list control variable is m_listctrl

CFont fnt;
// create the MS Shell Dlg font with size 8, Note you need to pass 80 for size 8
fnt.CreatePointFont(80, "MS Shell Dlg");
m_listctrl.SetFont(&fnt);
fnt.Detach();


this should do it.
0
 

Author Comment

by:ManojKrChauhan
ID: 12275881
Thanks
       I set the font of ListControl "MS Shell Dlg" now. But it's columns don't display properly. While all strings on dialog box display correctly. So please tell what should do now.
 Thanks
0
 
LVL 6

Accepted Solution

by:
nabehs earned 50 total points
ID: 12275933
the method I showed you to set the font should work for both columns and items. Once you set the font for the items in the list control, it will also set it for the columns. Try to add the columns the following way:

m_list.InsertColumn(0, "Column 1", LVCFMT_LEFT, 200);
m_list.InsertColumn(1, "Column 2", LVCFMT_LEFT, 300);

// where 200 and 300 are the column widths
0
 

Author Comment

by:ManojKrChauhan
ID: 12276348
m_list.InsertColumn(0, "Column 1", LVCFMT_LEFT, 200);

It works correctly. But as i said, the column name which i pick from string table resource. If column name is in English then i see it exactly as it written in string table. But if column name is in chinese then i see it as ||||||  which is garbage value. So tell how to do for chinese strings.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now