Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Font For List Control

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
ManojKrChauhan
Asked:
ManojKrChauhan
  • 4
  • 4
1 Solution
 
nabehsCommented:
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
 
ManojKrChauhanAuthor Commented:
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
 
nabehsCommented:
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
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
ManojKrChauhanAuthor Commented:
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
 
nabehsCommented:
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
 
ManojKrChauhanAuthor Commented:
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
 
nabehsCommented:
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
 
ManojKrChauhanAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now