Measure Size Of Rendered Text In WPF
Problem: Get the size that arbitrary text will take to adjust width, height of a control or control wrapping.
Solution:
FormattedText formattedText = new FormattedText(text,
Thread.CurrentThread.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(fontFamilyName),
fontSize,
Brushes.Black);
return formattedText.Width;
Advertisement
No comments yet.
Leave a Reply
-
Recent
- Run a bash script with sudo, nohup and in the background
- Contact database with web interface – EVPO Members
- Measure Size Of Rendered Text In WPF
- Suse 11 workstation as a router
- Remote desktop via VPN from SUSE 11.1
- EVPO DC project structure
- EVPODC Getting Started Part 2 (Configuration)
- EVPODC getting started part 1 (installation)
- Customize property editor in the VS designer
- How to load referenced assemblies from any place you want
- The puzzle about a car and two goats
- Effect of XML:Space=”preserve”
-
Links
-
Archives
- February 2012 (2)
- October 2010 (1)
- February 2010 (1)
- May 2009 (2)
- November 2008 (2)
- June 2008 (5)
-
Categories
-
RSS
Entries RSS
Comments RSS