|
Page 2 of 3
.
.
RichTextBox
Rich Text Box control is used for displaying, entering and manipulating rich text with formatting. Rich text format (RTF) supports many formats. The following code sample shows the usage of Rich Text Boxes and how we can load TRF documents to them.
Click here for the Sample Code
We shall take a look at some of the methods, properties and events of RichTextBoxes:
|
Property/Method/Event
|
Description
|
|
DetectUrls
|
Gets/Sets a value specifying if the rich text box should detect URLs when type into the RichTextBox Control
|
|
Rtf
|
Get/Sets the kind of scroll bars to display in the TichTextBox Control
|
|
SelectedRtf
|
Gets/Sets the currently selected rich text format formatted text in the control
|
|
ZoomFactor
|
Gets/Sets the current zoom level of the rich text box
|
|
LoadFile
|
Loads the contents of a file into the RichTextBox
|
The events defined for this control are the same as those defined for the TextBox Control.
PictureBox
With the Windows Forms System.Windows.Forms.PictureBox control, you can load and display a picture on a form at design time by setting the System.Windows.Forms.PictureBox.Image property to a valid picture. Acceptable file types which can be any of the following:
|
Type
|
File Extension
|
|
Bitmap
|
.bmp
|
|
Icon
|
.ico
|
|
GIF
|
.gif
|
|
Metafile
|
.wmf
|
|
JPEG
|
.jpg
|
To display a picture at design time
1. Drag and drop a PictureBox control on a form from the ToolBox.
2. On the Properties window, select the Image property, then click the ellipsis button to display the Open dialog box.
3. If you are looking for a specific file type (for example, .gif files), select it in the Files of type box.
4. Select the file you want to display.

To clear the picture at design time
On the Properties window, select the Image property and right-click the small thumbnail image that appears to the left of the name of the image object. Choose Reset.
You can also add picture to the control at runtime and also change the properties at run time to perform activities like, stretching the image. The following lines of code demostrate the tasks like adding picture to the control at run time and also sets value for the PictureBox1.SizeMode as PictureBoxSizeMode.StretchImage.
Press F5 to execute and see the effect.
Click here for the Sample Code
The first screenshot shows the image added to the program at run time using bitmap Object.

The second screenshot shows the image added to the picture control to display using the method FromFile. The SizeMode of this control is set to stretch causing the image to be stretched.

GroupBox
Windows Forms GroupBox controls are used to provide an identifiable grouping for other controls. Typically, you use group boxes to subdivide a form by function. For example, you may have an order form that specifies mailing options such as which overnight carrier to use. Grouping all options in a group box gives the user a logical visual cue, and at design time all the controls can be moved easily — when you move the single System.Windows.Forms.GroupBox control, all its contained controls move, too. The group box's caption is defined by the GroupBox.Text property.
Panel
All the features of the GroupBox are applicatble for the Panel control also. Additionally the Panel control can have a ScrollBar while the GroupBox displays the caption.
|