Articles in this section

How to display the Arabic number digits in WinForms GridControl when the culture is Arabic?

Setting the Arabic number digits in the grid cell


By default, the native number digits of a particular culture language are not displayed in the WinForms GridControl since text is displayed using GridStaticCellRenderer.

To reproduce the native number display in Grid, follow the given steps.

  1. Go to Control Panel.
  2. Select Region
  3. Change the Format as Arabic (Egypt).
  4. Click the Additional Settings button.
  5. In the Numbers tab, change the Use native digits option as National.
  6. Click the Apply button and then click the OK button.


Solution

The native number digits of the culture language, that is, Arabic numbers, can be displayed in a grid cell by handling the DrawCellDisplayText event and displaying the text using TextRenderer.

//Triggering the DrawCellDisplayText event
this.gridControl1.DrawCellDisplayText += gridControl1_DrawCellDisplayText;

void gridControl1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e)
{
   //Canceling the default display text using default cell renderer
   e.Cancel = true;

   //Displaying the text with TextRenderer instead of GridStaticCellRenderer
   TextRenderer.DrawText(e.Graphics, e.DisplayText, gridControl1.Font, e.ClipBounds, e.Style.TextColor);
}
'Triggering the DrawCellDisplayText event
AddHandler Me.gridControl1.DrawCellDisplayText, AddressOf gridControl1_DrawCellDisplayText

Private Sub gridControl1_DrawCellDisplayText(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs)
    'Canceling the default display text using default cell renderer
    e.Cancel = True

    'Displaying the text with TextRenderer instead of GridStaticCellRenderer
    TextRenderer.DrawText(e.Graphics, e.DisplayText, gridControl1.Font, e.ClipBounds, e.Style.TextColor)
End Sub 

Note:

To display the Arabic native digits in GridGroupingControl, the TableControlDrawCellDisplayText event can be handled.

//Triggering the TableControlDrawCellDisplayText event
this.gridGroupingControl1.TableControlDrawCellDisplayText += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellDisplayTextEventHandler(gridGroupingControl1_TableControlDrawCellDisplayText);

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellDisplayTextEventArgs e)
        {
            //Canceling the default display text using default cell renderer
            e.Inner.Cancel = true;

            //Displaying the text with TextRenderer instead of GridStaticCellRenderer
            TextRenderer.DrawText(e.Inner.Graphics, e.Inner.DisplayText, e.Inner.Style.Font.GdipFont, e.Inner.ClipBounds, e.Inner.Style.TextColor);
        }
'Triggering the TableControlDrawCellDisplayText event
AddHandler gridGroupingControl1.TableControlDrawCellDisplayText, AddressOf gridGroupingControl1_TableControlDrawCellDisplayText

Private Sub gridGroupingControl1_TableControlDrawCellDisplayText(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellDisplayTextEventArgs)
 'Canceling the default display text using default cell renderer
 e.Inner.Cancel = True

 'Displaying the text with TextRenderer instead of GridStaticCellRenderer
 TextRenderer.DrawText(e.Inner.Graphics, e.Inner.DisplayText, e.Inner.Style.Font.GdipFont, e.Inner.ClipBounds, e.Inner.Style.TextColor)
End Sub

Screenshots:

Row header numbers and grid cell data are shown in arabic digits

Figure 1: GridControl

 

Row header numbers and grid cell data are shown in arabic digits

Figure 2: GridGroupingControl


Samples:

C# - Displaying_The_Arabic_Number_Digits_in_Grid_CS1269007616.zip

VB - Displaying_The_Arabic_Number_Digits_in_Grid_VB1192759562.zip

 

Conclusion

I hope you enjoyed learning how to display the Arabic number digits in WinForms GridControl when the culture is Arabic.

 

You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications.

 

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

 

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied