Csharp/CSharp Tutorial/I18N Internationalization/Resource File

Материал из .Net Framework эксперт
Версия от 15:14, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Internationalization Form: default culture info

<source lang="csharp">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

  1. Default culture resources

WindowText = Internationalization example LabelText = Hello World!!!

  • /</source>