pictureboxes a picture box displays an image. you can find it in toolbox, drag it in the form images...
Post on 20-Dec-2015
215 Views
Preview:
TRANSCRIPT
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
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
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
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
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
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
top related