6
PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be .bmp, .gif, .jpg, jpeg GIF and JPEG files are widely used image file format Properties Image: image to display in the picture box SizeMode:controls image sizing and positioning

PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the

form Images can be .bmp, .gif, .jpg, jpeg GIF and JPEG files are widely used image

file format Properties

Image: image to display in the picture box SizeMode:controls image sizing and

positioning

Page 2: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

SizeMode Normal: (default) puts image in top-

left corner of picture box StretchImage:resizes image to fit in

picture box CenterImage: puts image in middle AtuoSize: resizes picture box to hold

image

Page 3: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

Design GUI

Design GUI that contains one PictureBox and three labels( labels show name of the images, set the anchor property of the PictureBox so that it resize when the form resize

Page 4: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

Download three pictures if you have image files with you, you can

use them If you don’t have any image file,

download three images from internet Create a folder in you project folder,

name the folder as image Save three image files in the image folder

Page 5: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

MouseEnter, MouseLeave Write proper code so that When mouse enter the first label, the

pictureBox will show the first picture When mouse enter the second label, it

will show the second picture When mouse enter the third label, it will

show the third label Read next slide for help

Page 6: PictureBoxes A picture box displays an image. You can find it in toolbox, drag it in the form Images can be.bmp,.gif,.jpg, jpeg GIF and JPEG files are

Set the image property To set the image property to an

image file imagePictureBox->Image =

Image::FromFile(String::Concat(Directory::GetCurrentDirectory(), S”\\image\\myboy.jpeg”) ;

Where imagePictureBox is the name of control (The PictureBox) Directory::GetCurrentDirectory() retrieve the current directory name, ie.

Where you create your project image is the folder I asked you to create and put your image files in it. Myboy.jpeg is example of image file name, you need to change to your

image file names