다음을 통해 공유


Windows Forms Resource Editor (Winres.exe)

The Windows Forms Resource Editor is a visual layout tool that helps localization experts localize Windows Forms forms. The .resx or .resources files that are used as input to Winres.exe can be created using a visual design environment such as Microsoft Visual Studio .NET. For information on deploying resources in .NET Framework applications, see Resources in Applications.

winres resourceFile
Argument Description
resourceFile The resource file to localize. This file must be a Windows Forms form .resx or .resources file generated by the Visual Studio. NET designer. Winres.exe cannot open generic .resx or .resources files.
Option Description
/? Displays command syntax and options for the tool.

Remarks

Winres.exe hosts the Windows Forms Form Designer and Properties window. You can use these features to open a .resources, or .resx, file for a neutral culture, containing a Windows Forms form to localize. In the designer, localizers can edit control labels and adjust the location and size of controls to accommodate the labels for the target culture. Winres.exe allows you to save these modifications in a localized .resx or .resources file for the target culture.

Winres.exe allows third-party localizers to recreate a design-time version of a Windows Forms form and localize it without having access to the source code or all the controls on the Windows Forms form. If Winres.exe cannot resolve the type of a control, it creates a placeholder control in the localized .resx or .resources file. The placeholder control appears on the Windows Forms form as a hatched window. The size and position of the hatched window matches that of the actual control. All the available localizable properties for the placeholder control appear in the Properties window. Any changes that you make to the placeholder control are saved in the actual control.

Note   Do not use Winres.exe to edit strings for a neutral culture. Winres.exe saves only localizable properties to the target file. All other information is lost.

Before you begin to localize an application's Windows Forms forms, you should decide whether you want to use Visual Studio .NET or Winres.exe as the localization tool. The localized .resx files produced by each tool are not interchangeable. Therefore, after you have started to localize with one tool, you cannot switch to the other tool.

The advantage of Visual Studio .NET is that you can use it to both develop and localize an application. To localize a form, after development is complete, set the form's Localizable property to true and change its Language property to the desired target culture. Then, edit strings and adjust the location and size of controls to accommodate the strings for the target culture. When you save the localized .resx file, Visual Studio .NET writes only the localizable properties (properties that changed in the target culture) to the file. Visual Studio .NET automatically creates a satellite assembly for the localized .resx file in the correct directory location. For more information on using Visual Studio .NET to localize forms, see Walkthrough: Localizing Windows Forms in the Visual Studio .NET documentation.

Although Visual Studio .NET provides an integrated development and localization environment, Winres.exe is the recommended tool to use if localization will be done by third-party localizers. Because Winres.exe is a localization tool only, it allows for a cleaner separation of an application's code from the forms to be localized and is more practical for managing large projects.

To localize using Winres.exe, you must first develop an application using a visual designer like Visual Studio .NET. When development is complete, set the form's Localizable property to true, and then hand off the .resx file for the neutral culture to a third-party localizer. This .resx file contains extra information that Winres.exe uses to recreate a design-time version of the original form. Due to the differences in the content of the .resx files produced by Winres.exe and Visual Studio .NET, Winres.exe cannot open a .resx file that was previously localized for a target culture using Visual Studio .NET. For example, Winres.exe can open the neutral file project1.resx, but it cannot open the localized file project1.fr-FR.resx generated by Visual Studio .NET. Likewise, a .resx file that was localized for a target culture using Winres.exe is not compatible with Visual Studio .NET. If you choose to use Winres.exe as your localization tool, you must convert your localized .resx files into .resources files using the Resource File Generator (Resgen.exe). Then use either the Assembly Linker (Al.exe) or the C# Compiler (Csc.exe) to compile the .resources files into satellite assemblies. For more information on this process, see Creating Satellite Assemblies.

Examples

To localize a .resx or .resources file associated with a form

  1. Type winres at the command prompt to run Winres.exe.

  2. To open the neutral resources for a form to localize, click the Open command on the File menu and navigate to the file to open. Alternately you can specify the file to open at the command line when you start Winres.exe. The following command starts Winres.exe and loads the form associated with MyResources.resx in the Form Designer.

    winres MyResources.resx
    

    The following command starts Winres.exe and loads the form associated with MyResources.resources in the Form Designer.

    winres MyResources.resources
    
  3. Select controls on the form and change text properties to reflect the localized language. Move or resize controls as necessary to accommodate the localized text.

  4. To save the localized version of the .resx or .resources file, click the Save As command on the File menu. The tool displays the Select Culture window. Double-click the appropriate culture. The tool saves the file, using the naming convention that the runtime expects for localized resource files. For example, if you localize MyResources.resources for German in Germany, the tool saves the file as MyResources.de-DE.resources. If you localize MyResources.resx for German in Germany, the tool saves the file as MyResources.de-DE.resx. For more information on resource naming conventions, see Packaging and Deploying Resources. For a list of the predefined culture names used by the runtime, see the CultureInfo Class.

See Also

.NET Framework Tools | Resources in Applications | Developing World-Ready Applications