Creating a Status Bar


The last control I'm going to show you in this hour is the Status Bar control. The Status Bar isn't nearly as fancy, or even as useful, as other controls such as the ToolStrip or the MenuStrip (but it's also not as difficult to work with either). A status bar adds value to an application in that it makes available information in a standard location, and users have come to expect it. In its simplest form, a status bar displays a caption and sizing gripthe dots to the right of the control that the user can drag with the mouse to change the size of the form.

Add a new status bar to the form now by double-clicking the StatusStrip item in the toolbox (located in the Menus & Toolbars category). You'll need to use the vertical scroll bar to the left in the designer to scroll down and see the status bar at the bottom of your form. Change the name of the StatusStrip to sbrMyStatusStrip. Because of the way you have anchored your other controls, the status strip overlays a few controls at the bottom of the form. Fix this now by following these steps:

1.

Click the PictureBox on the form and change its Size property to 282,264.

2.

Change the Location.Y property of the Shrink and Enlarge buttons to 293. Your form should now look like Figure 9.15.

Figure 9.15. Status bars always appear at the bottom of a form.


Take a look at the left edge of the StatusStrip. Does it look familiar? It's similar to the interface you have for adding menu items to MenuStrips and buttons to ToolStrips. Click the drop-down arrow now and choose Status Label. A new status label appears. If it does not have the focus, click the label to give it the focus (it has the text ToolStripStatusLabel1), and then change its properties as follows:

Property

Value

Name

pnlStatus

Text

no image loaded


You probably noticed when you opened the drop-down to create the status label that you can place items of other types on the status strip as well. For now, the label will due. In Hour 10, you'll write code to display the opened picture file name in the label.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net