⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form3.cs

📁 清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace Localisation
{
  public partial class Form3 : Form
  {
    public Form3()
    {
      InitializeComponent();

      CultureInfo ci = CultureInfo.CurrentCulture;
      CultureInfo ci2 = CultureInfo.CurrentUICulture;

      this.Text = ci.Name + ", " + ci2.Name; //always the same
    }

    private void Form3_Load(object sender, EventArgs e)
    {
      comboBox1.Items.Add(new CultureInfo("fr-FR"));
      comboBox1.Items.Add(new CultureInfo("fr-CA"));
      comboBox1.Items.Add(new CultureInfo("en-GB"));
      comboBox1.Items.Add(new CultureInfo("en-CA"));
      comboBox1.Items.Add(new CultureInfo("el-GR"));
      comboBox1.Items.Add(new CultureInfo("de-DE"));
      comboBox1.Items.Add(new CultureInfo("es-ES"));
      comboBox1.Items.Add(new CultureInfo("de-AT"));
      comboBox1.Items.Add(new CultureInfo("ru-RU"));

      // PlatfromNotSupportedException for Japanese
      //comboBox1.Items.Add(new CultureInfo("ja-JP"));

      comboBox1.SelectedIndexChanged += 
              new EventHandler(comboBox1_SelectedIndexChanged);
    }

    void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
      this.Render((CultureInfo)comboBox1.SelectedItem);     
    }

    private void Render(CultureInfo ci)
    {
      textBox1.Text = ci.Name;
      textBox2.Text = ci.EnglishName;
      textBox3.Text = ci.NativeName;
      textBox4.Text = ci.LCID.ToString();
      textBox5.Text = ci.DateTimeFormat.FirstDayOfWeek.ToString();
      textBox6.Text = ci.NumberFormat.CurrencySymbol;
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -