| | Sun | Mon | Tue | Wed | Thu | Fri | Sat | | 27 | 28 | 29 | 30 | 31 | 1 | 2 | | 3 | 4 | 5 | 6 | 7 | 8 | 9 | | 10 | 11 | 12 | 13 | 14 | 15 | 16 | | 17 | 18 | 19 | 20 | 21 | 22 | 23 | | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | 31 | 1 | 2 | 3 | 4 | 5 | 6 |
Search
Navigation
Categories
Blogroll
Other Stuff
|

Friday, January 11, 2008
Wrapped Text with GDIPlusX
I was recently asked if it was possible to do "Wrapped Text" with GDIPlusX. I wasn’t sure what they meant at first, but found out they wanted a text string to render in the form a circle, instead of a straight line. While there is nothing built into the library that can do this, I knew it was possible to write your own code to get this functionality.
I dug around and found an excellent article written by Sjaak Priester. He came up with a very interesting technique. By using the FlattenPath method of a GraphicsPath and some straight forward geometry, he was able to not only get a text string to render in a circle, but to get a text string to render in any shape by using a GraphicsPath as a guide. He developed a very nice little C++ class to handle this. I was impressed by the simple yet powerful technique he was using, I decided to try it using the GDIPlusX library.
The results are attached. A relatively straight forward, 300+ line class that takes a GraphicsPath guide, a String of text and a Font and fills a second GraphicsPath with the rendered string, following the specified path. Once you have this rendered path, you can do all kinds of cools stuff with it (check out some of the text effect samples with the GDIPlusX samples download).
Included in this download is the WrappedText class, a demo form as well as the 1.10 version of the GDIPlusX library (compiled into an app). To run the demo, issue a:
DO FORM WRAPPEDTEXTDEMO
WrappedTextDemo.zip (210.63 KB)
Friday, January 11, 2008 7:56:52 AM (Eastern Standard Time, UTC-05:00)