Click here to Skip to main content
11,934,380 members (53,860 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# WPF C#4.0
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;
Posted 28-Jan-12 21:36pm
Edited 28-Jan-12 21:45pm
Abhinav S407.8K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is done using the class System.Windows.Media.FormattedText, please see:[^].

Also, see the code sample in this discussion:[^].

Amir Mahfoozi 29-Jan-12 2:53am
SAKryukov 29-Jan-12 3:09am
Thank you, Amir.
sajithnet 29-Jan-12 3:16am
Many thanks SAKryukov
SAKryukov 29-Jan-12 3:38am
No problem at all.
Good luck, call again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 29 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100