GrapeCity MultiRow Windows Forms Documentation
Template Localization

The template consists of language resources as per the localization framework of the .NET Framework, similar to the form (System.Windows.Forms.Form), and thus can be easily interchanged to display various languages. For details on the globalization support of Visual Studio and the .NET Framework, refer to MSDN Globalizing and Localizing Applications.

Localizing a Template

The following steps show how to create forms and templates which have Japanese and English resources.

  1. Create a new Windows Forms application in Visual Studio.
  2. Open the form (Form1), place two button controls, and set the Text property to Japanese and English (for example: Button1, Button2).

    Form1 の例

  3. From the Visual Studio menu, select Project - Add New Item, and add two forms (for example: Form2).
  4. Place a Label control and a GcMultiRow control on Form2 (for example: Label1 and GcMultiRow1).
  5. Put "This is an English message." in the Text property of Label1.

    Example of Form2

  6. Set the Localizable property of Form2 to True.
  7. Set the Language property of Form2 to Japanese.
  8. Set the Text property of Label1 to Japanese text.

    Example of Form2

  9. Open Form1 and write the following code in the Button control click event.

    [VB]

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("ja")
        Dim form As New Form2()
        form.ShowDialog()
    End Sub
    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en")
        Dim form As New Form2()
        form.ShowDialog()
    End Sub
    

    [CS]

    private void button1_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ja");
        Form2 form = new Form2();
        form.ShowDialog();
    }
    
    private void button2_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
        Form2 form = new Form2();
        form.ShowDialog();
    }
    
  10. Run the project and click on the English and Japanese buttons on Form1, to see the differences.

You can see the result of form localization with the above example.

The next example localizes the templates that are displayed in the GcMultiRow control.

  1. From the Visual Studio menu, select Project - Add New Item.
  2. Select MultiRow 7.0 Template from the list and click on the Add button.
  3. Create a screen that looks like the following. Use corner header cells, column header type cells, row header type cells, and string type cells.

    Example of Template1

  4. Add Zip Code and Address to the Value property of the two column headers (ColumnHeaderCell).

    Example of Template1

  5. Set the Localizable property of the template to True.
  6. Set the Language property of the template to Japanese.
  7. Change the Value property of the two column headers (ColumnHeaderCell) to:

    Example of Template1

  8. Open Form2. Select the template (Template1) from the smart tag of the GcMultiRow control.

    Example of Template1

  9. Run the project and click the Japanese and English buttons respectively on Form1 to see the differences.

When you click the Japanese button on Form1, the Japanese screen is displayed as shown below.

Japanese screen

Click the English button on Form1 to display the English screen as shown below.

English Screen

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options