How To Calculate TextWidth?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiberg
    New Member
    • Jul 2007
    • 12

    #1

    How To Calculate TextWidth?

    Hi

    Code:
    Graphics g;
    g.drawString("Hello World!", 10, 10);
    I don't know it what kind of wide the text.How to calculate it?
    ThAnKs!
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by kiberg
    Hi

    Code:
    Graphics g;
    g.drawString("Hello World!", 10, 10);
    I don't know it what kind of wide the text.How to calculate it?
    ThAnKs!
    The size of the text is determined by the current Font set for the graphics context.
    See the specs for how to get the Font and FontMetrics.

    Comment

    Working...