Csharp/CSharp Tutorial/I18N Internationalization/Resource File

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Internationalization Form: default culture info

using System;
using System.Drawing;
using System.Collections;
using System.ruponentModel;
using System.Globalization;
using System.Windows.Forms;
using System.Data;
using System.Resources;
class I18NForm: Form
{
  public I18NForm()
  {
    ResourceManager rm=new ResourceManager("firstresource",this.GetType().Assembly);
    this.Size = new Size(400,100);
    this.Text=rm.GetString("WindowText");
    Label l = new Label();
    l.Location = new Point(3,5);
    l.Size = new Size(394,90);
    l.Font = new Font("Tahoma",36F,FontStyle.Bold);
    l.Text=rm.GetString("LabelText");
    this.Controls.Add(l);
  }
  static void Main()
  {
    Application.Run(new I18NForm());
  }
}
/*
File: firstresource.txt
#Default culture resources
WindowText = Internationalization example
LabelText = Hello World!!!
*/