Another OwnerDraw Example - This Time Adding Red Squiggles to Text in a TextBox
Coded - Web Development and Programming Blog - Owner-drawing a Windows.Forms TextBox
"This article describes how SharpSpell is able to modify existing TextBox controls to display wavy red underlines below misspelled words.
Here’s an image to demonstrate what I mean:
(This image is borrowed from SharpSpell, but you get the point)...
Now to use this class, you just need to instantiate it by passing a TextBox control to the constructor. Make sure you keep a reference to it at the module level so it doesn’t get eaten by the Garbage Collector.
CustomPaintTextBox customUnderlines = new CustomPaintTextBox(textBox1);
I haven’t really tested this stripped out version of the class, but it should work. Most of it is taken directly from the SharpSpell source code.
I hope this article helps you understand how to owner draw native Win32 controls using the .NET framework. If you have any questions please leave a comment."
This is a cool short C# article on owner drawing a textbox, providing a nice example of both text measuring and adding visual status indicators.
(via Larkware News - The Daily Grind 1234)
2 comments:
Ummm, where can I find the article text?
Click on the link at the top of this post titled "Owner-drawing a Windows.Forms TextBox"
Post a Comment