PictureBox

 

Picture Box is responsible for displaying a picture that is read from a file.  The image file format may be any format that is supported by Windows (e.g. JPEG, GIF, BMP AND WMF). The PictureBox attributes are discussed below.

bullet

Name = S

This attribute denotes the actual name of the PictureBox. Its value S denotes a string value that can be included in single or double quotes.

bullet

Image

This attribute specifies the specific location of the file where the image resides, written in usual windows notation e.g. 'C:/pictures/pic.jpg'. The file name must usually be include in single quote characters.

bullet

Height and Width

These attributes specify the desired height and length for the picture that is to be displayed on the PictureBox. If the attributes settings Height = M & Width = M are provided then the picture will be displayed with the height M and Width M, where M denotes the size measure.

bullet

ForeColor and BackColor

ForeColor denotes the Color of the displayed item and BackColor is for the background Color on the PictureBox.  If the attribute settings ForeColor = C1 and BackColor = C2, the background of the PictureBox will be of C2 whereas the color of the item being displayed on the PictureBox of C1, where C1 and C2 are Color names.

bullet

Font = FNT

 

bullet

halign and valign

The halign peoperty denotes the horizontal alignment of the item on the PictureBox, and its value HA can be Left, Right or Center (views will accept spelling "Centre" as well).  The valign property will denote the vertical alignment of the item on the Picture.  Its value VA can be Top, Middle or Bottom.

 

Examples of PictureBox

Example 2.5.1: Source

                     Save Picture

@"<Form Text= 'Photo Album'>
<Vertical>
<Label Text = 'PictureBox Example: Photo Album'/>
<PictureBox Name = picbox Height = 4.0in Width = 3.0in image = 'pic.jpe' />
<Horizontal>
<Button Name = btnPrev Text = 'Previous' halign = Center />
<Button Name = btnNext Text = 'Next' halign = Right />
</Horizontal>
</Vertical>
</Form>";

This Image will be displayed by the code above.

                 

 

 

<<PREVIOUS   NEXT >>