Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Font For List Control

Posted on 2004-10-08
9
Medium Priority
?
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

609 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