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
-
i have struck with my project in vb.net
by jack_ravi (2 replies)
-
Error in VB code
by glib162002 (0 replies)
-
Very slow inserts using SqlCommand.ExecuteNonQuery()
by porchelvi (1 replies)
-
Datagridview Setting datasource property of datagridviewcomboboxcell at run time
by sairfan1 (2 replies)
-
vb.net mp3 +g player
by novavb6 (1 replies)
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum)
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
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.