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. Windows Forms
  4. Localization and form size [modified]

Localization and form size [modified]

Scheduled Pinned Locked Moved Windows Forms
graphicshelpquestion
4 Posts 3 Posters 2 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.
  • T Offline
    T Offline
    T RATHA KRISHNAN
    wrote on last edited by
    #1

    Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:

    switch(listIndex)
    {
    case 0:
    cultureCode = "en-US"; //Culture code for English US
    this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
    break;
    case 1:
    cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
    this->Font = System::Drawing::Font(L"Simsun",8);
    break;
    case 2:
    cultureCode = "fr-FR" //Culture code for French
    this->Font = System::Drawing::Font(L"Verdana",8);
    break;
    default:
    }
    System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
    System.Threading.Thread.CurrentThread.CurrentCulture = ci;
    System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

    My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?

    modified on Thursday, March 31, 2011 1:19 PM

    B R 2 Replies Last reply
    0
    • T T RATHA KRISHNAN

      Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:

      switch(listIndex)
      {
      case 0:
      cultureCode = "en-US"; //Culture code for English US
      this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
      break;
      case 1:
      cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
      this->Font = System::Drawing::Font(L"Simsun",8);
      break;
      case 2:
      cultureCode = "fr-FR" //Culture code for French
      this->Font = System::Drawing::Font(L"Verdana",8);
      break;
      default:
      }
      System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
      System.Threading.Thread.CurrentThread.CurrentCulture = ci;
      System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

      My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?

      modified on Thursday, March 31, 2011 1:19 PM

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      A Windows form has the properties AutoSize and AutoSizeMode. You can set AutoSize to false to prevent any size changes, or AutoSizeMode to GrowOnly to allow for a growing form.

      T 1 Reply Last reply
      0
      • B Bernhard Hiller

        A Windows form has the properties AutoSize and AutoSizeMode. You can set AutoSize to false to prevent any size changes, or AutoSizeMode to GrowOnly to allow for a growing form.

        T Offline
        T Offline
        T RATHA KRISHNAN
        wrote on last edited by
        #3

        Hi! Thanks for the reply. Setting the font is not enough to display Chinese Text over Title Bar of the form(Caption of the Form). Every language Text is displayed properly else where except the Caption of the Form. What to do to dispaly Chinese Text over the caption of the form?

        1 Reply Last reply
        0
        • T T RATHA KRISHNAN

          Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:

          switch(listIndex)
          {
          case 0:
          cultureCode = "en-US"; //Culture code for English US
          this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
          break;
          case 1:
          cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
          this->Font = System::Drawing::Font(L"Simsun",8);
          break;
          case 2:
          cultureCode = "fr-FR" //Culture code for French
          this->Font = System::Drawing::Font(L"Verdana",8);
          break;
          default:
          }
          System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
          System.Threading.Thread.CurrentThread.CurrentCulture = ci;
          System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

          My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?

          modified on Thursday, March 31, 2011 1:19 PM

          R Offline
          R Offline
          RobCroll
          wrote on last edited by
          #4

          I've noticed one problem with the code snippet.

          System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");

          Looks like it should be

          System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(cultureCode);

          Also the way I've handled globalisation is by using resource files and letting the system's culture determine which resource file to use. You might want to Read these MSDN articles

          "You get that on the big jobs."

          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