Link to home
Start Free TrialLog in
Avatar of ManojKrChauhan
ManojKrChauhan

asked on

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
Avatar of nabehs
nabehs

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
Avatar of ManojKrChauhan

ASKER

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
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

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
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.
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
ASKER CERTIFIED SOLUTION
Avatar of nabehs
nabehs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.