Library tutorials & articles
RichTextLabel WinForms Control
- Introduction
- The Solution
- Wrapping it up in a Control
Introduction
A couple of weeks ago, I've had a busy weekend working on a soon-to-be-released .NET component. The feature I was working on was a nag dialog that the evaluation version of the component should display occasionally. Obviously, I wanted the dialog to show up quickly and also to look attractively . I also wanted to be able to display an active hyperlink that would take the user to the product's site when clicked.
Another possible example needing a similar functionality might be an 'About' dialog box. (I've seen a couple of 'About' dialogs containing just plain text, even with non-clickable homepage and 'purchase' hyperlinks). Splash screens could also have been more attractive displaying program information (name, version number...) in distinct fonts and colors, for example. Or, consider the various 'TIP:' labels scattered throughout dialog boxes in some applications. More often than not, decent formatting could have improved readability and thus the usability of the dialog.
Let's go back to my nag dialog. As I said, I wanted to use formatted text and graphics to make it look nice and "cool". I've considered the following possible implementation options:
-
Several differently formatted Label and LinkLabel controls.
I've abandoned this option quickly, because the formatted text should appear as "flowing" and I wasn't able to layout the differently formatted labels correctly. -
Third-party HTML rendering controls.
I've found a couple of ActiveX controls, but I didn't want to introduce any additional dependencies (and the interop overhead), so I didn't research the controls further. -
Hosting the WebBrowser control.
This is an ActiveX control, so it suffers from the same drawbacks as the previous approach. It's also too slow for the purposes of my nag dialog. -
The RichTextBox control.
The control supports text formatting and embedded graphics. It has also theDetectUrlsproperty meaning it can underline properly formatted URLs, display the 'hand' cursor when an user hovers the mouse over the link and it can also raise theLinkClickedevent when the link is clicked. The event can be handled with a small amount of code to show the URL in the user's browser.
In addition, by setting a couple of the control's appearance properties, it could be made to look and act like a non-editable, formatted label. And the control's display performance is really good.
For me, RichTextBox was a clear winner.
Related articles
Related discussion
-
MSSQL Query in VB.Net Fails
by 7upsk (1 replies)
-
bar graphs in visual basic.net
by bhabybash (1 replies)
-
How to write the category attribut in a class dynamically
by converter2009 (1 replies)
-
VB.NET: Hide and show table using radio buttons
by converter2009 (1 replies)
-
VB.Net Button Problem
by pysdex (0 replies)
Related podcasts
-
xpert to Expert: Inside Concurrent Basic (CB)
"Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...
I moved the control into a seperate dll (along with the editor), but the editor no longer finds the embedded rtf files in the exe. When I move the control back into the main application it works.
Any ideas what the problem might be?
Thanks,
Dave
i have a doubt...
when we use an input box in vb.net on clicking the ok button i get the input into the text box where required but how to activate the cancel button???
This thread is for discussions of RichTextLabel WinForms Control.