none
How yo measure a string Hight/Width in WPF

    Question

  • hi,
    How to measure the string size in WPF..In C1PdfDocument(component1PDF)have a function MeasureString(string,Font) to measure width/height of string do WPF has similar function.
     
    internal float GetWidth(string text,Font font) {
    C1PdfDocument pdf;
    return pdf.MeasureString(text,font).Width;
    }
     
    Regards,
    sajith
    Sunday, January 29, 2012 7:41 AM

Answers

  • Hi sajithtgs,

    Thank you for your post.

    According to your descritption, I understand you want to measure the height and width of a string. You can try to use Formatted Text in WPF to achieve your goal:

    For more detail information about it, please check out below link for your reference:http://msdn.microsoft.com/en-us/library/ms634943(v=VS.90).aspx

    If you have any additional questions, please feel free to let me know.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by sajithtgs Monday, January 30, 2012 9:50 AM
    Monday, January 30, 2012 8:47 AM
    Moderator

All replies