troubleshooting Question

How to determine width of new/selected text in a RichTextBox

Avatar of gem56
gem56 asked on
Visual Basic.NET
4 Comments1 Solution331 ViewsLast Modified:
Hi experts,
I have a RichtextBox that I'm populating with text by finding certain string patterns/fields and replacing them with real values. In some cases the new strings need to be right aligned within the original string pattern/field width.

To do that I would need to know how to determine width of new/selected text (given text size, font family, etc.) so that I can 'left pad' it with appropriate number of filler spaces.

Therefore my question is how can I determine text size in a RichtextBox?

Thanks,
     Michael
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros