0

テキストは任意の言語ですが、アプリケーションでペルシャ数字を使用したい このコードは Windows 7 では機能しますが、Windows 8 & 8.1 では機能しません。私を助けてください。

    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

4

1 に答える 1

0

これを使って

// Arabic (0x0C01) digits. 

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

// Use Traditional substitution method.
myStringFormat.SetDigitSubstitution(0x0C01,
    StringDigitSubstitute.Traditional);
g.DrawString(
    "Method of substitution = Traditional:  " + myString,
    myFont, blueBrush, new PointF(10.0f, 55.0f), myStringFormat);
于 2014-07-03T14:19:52.760 に答える