Hindi numbers in Graphics class

  • Thread starter Thread starter grawsha2000
  • Start date Start date
G

grawsha2000

Hi,

Is there a way to force Graphics.drawstring() method to display Hindi
numbers when printing?

I changed the locale settings of the Regional Options to an Arabic
lang. but no luck.


MTIA,
Grawsha
 
Hi,

Is there a way to force Graphics.drawstring() method to display Hindi
numbers when printing?

Just ask it to. The Devanagari numerals are unicode characters 0966
through 096F. Be sure to use a font that contains these characters,
such as Arial Unicode. Example: Create a new Windows Forms app, put a
picturebox on the form, add this code:

Private Sub PictureBox1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles PictureBox1.Paint

Dim deva_digits As Char() = New Char(9) {}
For i As Integer = 0 To 9
deva_digits(i) = ChrW(&H966 + i)
Next

Dim output As String = deva_digits(1) & deva_digits(2) & _
deva_digits(3) & "+" & deva_digits(4) & deva_digits(5) & _
deva_digits(6) & "=" & deva_digits(5) & deva_digits(7) & _
deva_digits(9)

Using unifont As Font = New Font("Arial Unicode", 14)
With e.Graphics
.DrawString(output, unifont, Brushes.Black, 0, 0)
End With
End Using
End Sub

I changed the locale settings of the Regional Options to an Arabic
lang. but no luck.

If what you actually mean is that you want to produce Devanagari digits
when output characters "0" through "9", I suspect this isn't going to
happen.
 
Hi,

Is there a way to force Graphics.drawstring() method to display Hindi
numbers when printing?

I changed the locale settings of the Regional Options to an Arabic
lang. but no luck.


MTIA,
Grawsha

Hello Grawsha,

Do this:

imports system.globalization
imports system.drawing

Dim sf as new stringformat
Dim hd as new cultureinfo("ar-SA") 'just select any arabic culture

sf.setdigitsubstitution(hd.lcid,stringdigitsubstitute.national)

yourGraphicObject.graphics.drawstring(string,font,brush,x,y,sf)


HTH,
Adel Al-saleh
 
Hello Grawsha,

Do this:

imports system.globalization
imports system.drawing

Dim sf as new stringformat
Dim hd as new cultureinfo("ar-SA") 'just select any arabic culture

sf.setdigitsubstitution(hd.lcid,stringdigitsubstitute.national)

Wow, that's pretty cool. Thanks for that!
 
Larry said:
Wow, that's pretty cool. Thanks for that!

Hello Larry,

Well, Thanks to the guyes at Microsoft for bringing good things to us,
developers.

Adel Al-saleh
 
Back
Top