Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Want Use Farsi Number in My Application While Text is Any Language This Code Work in Windows 7 But Not Work In Windows 8 & 8.1. Please Help me.

C#
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);
    SetDigitSubExample(e);
}

public void SetDigitSubExample(PaintEventArgs e)
{
    Graphics g = e.Graphics;
    SolidBrush blueBrush = new SolidBrush(Color.FromArgb(255, 0, 0, 255));
    Font myFont = new Font("Courier New", 12);
    StringFormat myStringFormat = new StringFormat();
    string myString = "0 1 2 3 4 5 6 7 8 9";

    // Farsi (1065) digits.

    // Use National substitution method.
    myStringFormat.SetDigitSubstitution(1065, StringDigitSubstitute.National);
    g.DrawString("Farsi:\nMethod of substitution = National:     " + myString, myFont, blueBrush, new PointF(10.0f, 20.0f), myStringFormat);

    // Use Traditional substitution method.
    myStringFormat.SetDigitSubstitution(1065, StringDigitSubstitute.Traditional);
    g.DrawString("Method of substitution = Traditional:  " + myString, myFont, blueBrush, new PointF(10.0f, 55.0f), myStringFormat);
}


Windows 7: http://tinypic.com/r/etb5gl/5
Windows 8: http://tinypic.com/r/30j1ysm/5
Posted

1 solution

Are you sure you have built the code in windows 8 environment? executing the same executable?
 
Share this answer
 
Comments
Nelek 14-Nov-13 7:35am    
Please don't post solutions to chat with people asking or answering. The messages are not always sorted by date, so it can be a bit difficult to follow them correctly.
The best option is to use the "Have a question or comment?" (or the tiny "reply" on another comment). Another advantage is, that the person you write to will get a notification, otherwise it could be that he/she doesn't see your additional question.
Kolkata .NET 14-Nov-13 8:38am    
Yup!! Agreed
ALI BAHARI SALIM 14-Nov-13 13:13pm    
Thanks.
Yes the source code is compiled in my win 8 final rtm and attached picture is shown.
also you can via source code test it (VMware or Virtual PC etc).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900