Localizing Your Windows Forms

Localization is the process of translating strings in your application to different languages. It also involves changing images and form layout.

Localization Features of Windows Forms

In Visual Studio .NET, the Windows Forms Designer is the localization tool. When you start an application, you change the Localization property on the Form to true and simply create your application in a normal fashion. Once the application is complete, you change the Language property of the Form to the language you choose. This generates a new .resx file for that language. All property changes are written to this new .resx file. When your application is run, the CLR checks the current locale and checks if the application has resources for that specific locale.

The following example shows how to get properties from a resource file.


Button1.Location = CType(resources.GetObject("Button1.Location"), System.Drawing.Point)
Button1.Size = CType(resources.GetObject("Button1.Size"), System.Drawing.Size)
Button1.TabIndex = CType(resources.GetObject("Button1.TabIndex"), Integer)
Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Image)
Button1.Text = CType(resources.GetObject("Button1.Text"), String)
VB


Copyright 2001 Microsoft Corporation. All rights reserved.