Home All Groups Group Topic Archive Search About

Hindi numbers in Graphics class

Author
29 Jun 2006 3:45 PM
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

Author
3 Jul 2006 10:20 AM
Larry Lard
grawsha2***@yahoo.com wrote:
> 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.

--
Larry Lard
Replies to group please
When starting a new topic, please mention which version of VB/C# you
are using
Author
5 Jul 2006 7:40 AM
alsaleha
grawsha2***@yahoo.com wrote:
> 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
Author
5 Jul 2006 8:45 AM
Larry Lard
alsal***@hotmail.com wrote:
Show quoteHide quote
> grawsha2***@yahoo.com wrote:
> > 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)

Wow, that's pretty cool. Thanks for that!

--
Larry Lard
Replies to group please
Author
6 Jul 2006 6:17 PM
alsaleha
Larry Lard wrote:
Show quoteHide quote
> alsal***@hotmail.com wrote:
> > grawsha2***@yahoo.com wrote:
> > > 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)
>
> Wow, that's pretty cool. Thanks for that!
>
> --
> Larry Lard
> Replies to group please

Hello Larry,

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

Adel Al-saleh