The RichTextBox control is the core of a full-blown word processor. It provides all the functionality of a TextBox control; it can handle multiple typefaces, sizes, and attributes, and offers precise control over the margins of the text (see Figure 4.16). You can even place images in your text on a RichTextBox control (although you… [Continue Reading]
Windows Controls
Text Manipulation and Formatting Properties of RichTextBox Control
The RichTextBox control provides properties for manipulating the selected text on the control. The names of these properties start with the Selection or Selected prefix, and the most commonly used ones are shown in Table 4.5. Some of these properties are discussed in further detail in following sections. Table 4.5 – RichTextBox Properties for Manipulating… [Continue Reading]
Advanced Editing Features in a RichTextBox Control
The RichTextBox control provides all the text-editing features you’d expect to find in a text-editing application, similar to the TextBox control. Among its more-advanced features, the RichTextBox control provides the AutoWordSelection property, which controls how the control selects text. If it’s True, the control selects a word at a time. In addition to formatted text,… [Continue Reading]
Searching in a RichTextBox Control
To locate a string in the text of the RichTextBox control, use the Find method. The Find method is quite flexible, as it allows you to specify the type of the search, whether it will locate entire words, and so on. The simplest form of this method accepts the search string as an argument and… [Continue Reading]
Handling URLs in the RichTextBox Document
An interesting feature of the RichTextBox control is the automatic formatting of URLs embedded in the text. To enable this feature, set the DetectURLs property to True. Then, as soon as the control determines that you’re entering a URL (usually after you enter the three w’s and the following period), it will format the text… [Continue Reading]
The RichTextBoxPad Project – RichTextBox Control
Creating a functional — even fancy — word processor based on the RichTextBox control is unexpectedly simple. The challenge is to provide a convenient interface that lets the user select text, apply attributes and styles to it, and then set the control’s properties accordingly. The RichTextBoxPad sample application of this section does just that. The… [Continue Reading]
ListView, TreeView, and ImageList Controls
Earlier in this chapter you learned how to use the ListBox control for displaying lists of strings and storing objects. The items of a ListBox control can be sorted, but they have no particular structure. I’m sure most of you wish that the ListBox control had more ‘‘features,’’ such as the means to store additional… [Continue Reading]
Tree and List Structures of TreeView Control
The TreeView control implements a data structure known as a tree. A tree is the most appropriate structure for storing hierarchical information. The organizational chart of a company, for example, is a tree structure. Every person reports to another person above him or her, all the way to the president or CEO. Figure 4.21 depicts… [Continue Reading]
ImageList Control
The ImageList is a simple control that stores images used by other controls at runtime. For example, a TreeView control can use icons to identify its nodes. The simplest and quickest method of preparing these images is to create an ImageList control and add to it all the icons you need for decorating the TreeView… [Continue Reading]
TreeView Control
Let’s start our discussion of TreeView control with a few simple properties that you can set at design time. To experiment with the properties discussed in this section, open the TreeView Example project. The project’s main form is shown in Figure 4.25. After setting some properties (they are discussed next), run the project and click… [Continue Reading]