Exforsys.com
 
Home Tutorials VB.NET 2005
 

.NET Common Windows Forms Controls Part 1

 

.NET Common Windows Forms Controls Part 1 - Page 2

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.




Next Page: .NET Common Windows Forms Controls Part 1 - Page 3


Read Next: DomainUpDown and NumericUpDown Controls



 

 

Comments


Marie Nedland said:

  I thought this was very useful but I was hoping for a little more information on the common controls of VB.Net 2005...such as the DateTimePicker, ListView, MaskedTextBox, MonthCalendar, NotifyIcon, ProgressBar, ToolTip, TreeView, and the WebBrowser tools. I mean they are listed under the common controls but I can hardly find any articles about them.
March 1, 2007, 10:34 am

Glenn said:

  Thanks it was very helpful..
Easy to follow/understand...
Thanks a lot
December 27, 2008, 2:25 am

Bob said:

  That was piggin' useless, you just stated the obvious, VS explains all that to you anyway, can you tell us how to program a button, to take user input from text boxes, combo boxes and masked text boxes, store it, then take text data from a database, and merge it with the users input data, and then display it all on screen?
February 25, 2009, 3:31 pm

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape