what is Graphics.StringWidth = on WebGraphics

I don’t see it, so I made a feedback case: 33241.

It’s intentional. Getting the width of a string would require a round trip to the browser.

Well, Greg, why not have a WriteString function which can write centered or right aligned text directly? You could make calculation on client.

There is a TextAlignment property to do just that.


so i replace Graphics.StringWidth with WebGraphics.TextAlignment

No. You set g.TextAlignment first and then draw your string. The coordinate that you supply will be the alignment point.

It may or may not work in your situation, but you can create a picture and draw your picture to the canvas. A picture has StringWidth. But, as Greg said, if you’re simply drawing text, use the TextAlignment property.