?
Solved

Font For List Control

Posted on 2004-10-08
9
Medium Priority
?
170 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…
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…
Suggested Courses

762 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