Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CListBox head language display problem

CListBox head language display problem

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stan the man
    wrote on last edited by
    #1

    Hi. When I try to display chinese or other characters in the column of the CListBox, it comes out jibberish. ENglish is fine. Can someone enlighten me why this is the case and how to allow other languages to work in the Clistbox? Thanks in advance. Stan the man

    H M 2 Replies Last reply
    0
    • S Stan the man

      Hi. When I try to display chinese or other characters in the column of the CListBox, it comes out jibberish. ENglish is fine. Can someone enlighten me why this is the case and how to allow other languages to work in the Clistbox? Thanks in advance. Stan the man

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Did you install china fonts on your system?

      S 1 Reply Last reply
      0
      • H Hamid Taebi

        Did you install china fonts on your system?

        S Offline
        S Offline
        Stan the man
        wrote on last edited by
        #3

        I can display correctly everything on buttons and static items. Only the ListBox seems to have this problem. Am not quite sure what is different between this and the other things. THanks. Stan the man

        N 1 Reply Last reply
        0
        • S Stan the man

          I can display correctly everything on buttons and static items. Only the ListBox seems to have this problem. Am not quite sure what is different between this and the other things. THanks. Stan the man

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          Stan the man wrote:

          Only the ListBox seems to have this problem

          May be it is because the current font in the list box dosent suport unicode. try setting some other fonts to it such as "Arial Unicode MS"

          nave [OpenedFileFinder]

          1 Reply Last reply
          0
          • S Stan the man

            Hi. When I try to display chinese or other characters in the column of the CListBox, it comes out jibberish. ENglish is fine. Can someone enlighten me why this is the case and how to allow other languages to work in the Clistbox? Thanks in advance. Stan the man

            M Offline
            M Offline
            Michael Schubert
            wrote on last edited by
            #5

            You have to set the correct character set. Try this in your "OnInitDialog()":

            LOGFONT lf;
            memset(&lf, 0, sizeof(LOGFONT));
            lf.lfCharSet = CHINESEBIG5_CHARSET; //or GB2312_CHARSET
            strcpy(lf.lfFaceName, "System"); //you can try other fonts but they have to support the language
            m_font.CreateFontIndirect(&lf);
            GetDlgItem(IDC_LIST)->SetFont(&m_font);

            where "m_font" is a CFont member variable and IDC_LIST is your CListBox ID.

            S 1 Reply Last reply
            0
            • M Michael Schubert

              You have to set the correct character set. Try this in your "OnInitDialog()":

              LOGFONT lf;
              memset(&lf, 0, sizeof(LOGFONT));
              lf.lfCharSet = CHINESEBIG5_CHARSET; //or GB2312_CHARSET
              strcpy(lf.lfFaceName, "System"); //you can try other fonts but they have to support the language
              m_font.CreateFontIndirect(&lf);
              GetDlgItem(IDC_LIST)->SetFont(&m_font);

              where "m_font" is a CFont member variable and IDC_LIST is your CListBox ID.

              S Offline
              S Offline
              Stan the man
              wrote on last edited by
              #6

              THank you everyone. That was the problem. Appreciate the help.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups