how can I determine the length of a trutype font string in pixels ? I need to be able to right justify a string. Using UD700, UC5550
I just came across this! It is there but I can’t remember what it was…
Let me check
is it Graphics.MeasureString
?
no, that’s not it. I looked in system.drawing and ghielectroniscs.tinclr.drawing
What are you looking to do that MeasureString
doesn’t work? You can right-align using the void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
overload, passing the desired alignment in the StringFormat
parameter.
This worked:
RectangleF r = new RectangleF(150, 92, 150, 30);
StringFormat s = new StringFormat();
s.Alignment = StringAlignment.Far;
scrn.DrawString("Gross: ", G.fontArial_12, G.BlackBrush, r, s);
Thanks!