You are on page 1of 2

Practical 11

PRACTICAL 11:
OBJECT: Program using Status Bar Control, Image List Control and Tool bar Control.
TOOLS: Visual Studio 2010 installed in the PC.
THEORY:

Status Bar Control:


By default, the Status Bar presents a single panel at the bottom of form. Do you know that a
status bar can be located elsewhere? Since it is a regular control, it has the Dock property.
Sizing Grip is a property specific to the Status Bar. When this property is set to True, the Status
Bar displays small diagonal lines at the lower-right corner of the control to cue the user that the
form is resizable (notice that you have to set it this property is not automatically set depending
on the FormBorderStyle property).
Status Bar control is not available in Toolbox of Visual Studio 2010. Status Strip
control replaces Status Bar in Visual Studio 2010. But for backward compatibility support,
Status Bar class is available in Windows Forms. In this article, I will discuss how to create and
use a Status Bar using Status Bar class in a Windows Forms application.
A Status Bar control is a combination of Status Bar panels where each panel can be
used to display different information. For example, one panel can display current application
status and other can display date and other information and so on. A typical Status Bar sits at the
bottom
of
a
form.
I highly recommend using Status Strip control if you are working with Visual Studio
2010.

Image List Control:


The Windows Forms ImageList component is used to store images, which can then be displayed
by controls. An image list allows you to write code for a single, consistent catalog of images. For
example, you can rotate images displayed by a Button control simply by changing the
button's ImageIndex or ImageKey property. You can also associate the same image list with
multiple controls. For example, if you are using both a ListView control and a TreeView control
to display the same list of files, changing a file's icon in the image list will cause the new icon to
appear in both views.

Using ImageList with Controls:


You can use an image list with any control that has an ImageList property or in the case of
the ListView control, SmallImageList and LargeImageListproperties. The controls that can be
associated with an image list include:
the ListView, TreeView, ToolBar, TabControl, Button, CheckBox, RadioButton,

Practical 11
and Labelcontrols. To associate the image list with a control, set the control's ImageList property
to the name of the ImageList component.

Key Properties
The key property of the ImageList component is Images, which contains the pictures to be used
by the associated control. Each individual image can be accessed by its index value or by its key.
The ColorDepth property determines the number of colors that the images are rendered with. The
images will all be displayed at the same size, set by the ImageSize property. Images that are
larger will be scaled to fit.

Tool Bar Control:


Represents a Windows toolbar. Although ToolStrip replaces and adds functionality to
the ToolBar control of previous versions, ToolBar is retained for both backward compatibility
and future use if you choose.
ToolBar controls are used to display ToolBarButton controls that can appear as a
standard button, a toggle-style button, or a drop-down style button. You can assign images to the
buttons by creating an ImageList, assigning it to the ImageList property of the toolbar, and
assigning the image index value to theImageIndex property each ToolBarButton. You can then
assign text to be displayed underneath or to the right of the image by setting the Text property of
theToolBarButton.
Set the Appearance property of the toolbar to Flat to give the toolbar and its buttons a
flat appearance. As the mouse pointer moves over the buttons, their appearance changes to threedimensional. Toolbar buttons can be divided into logical groups by using separators. A separator
is a toolbar button with the Styleproperty set to ToolBarButtonStyle.Separator. Button separators
appear as lines rather than spaces between the buttons when the toolbar has a flat appearance. If
the Appearance property is set to Normal, the toolbar buttons appear raised and threedimensional.
If you specify a value for the ButtonSize property, all buttons in the tool bar are
restricted to the specified size. Otherwise, the buttons adjust their size depending on their
content, and the ButtonSize property returns the initial size of the largest button.
To create a collection of ToolBarButton controls to display on the ToolBar, add the buttons
individually by using the Add or Insert methods of the Buttonsproperty.
Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE
Platform Note: A form supports only one ToolBar, attempts to add an additional ToolBar throws
a NotSupportedException. Adding a ToolBar to any control besides a form is not supported, such
as to a Panel.

You might also like