slide 1 vb graphics controls & timer control. slide 2 default controls
DESCRIPTION
Slide 3 Graphics File Formats used with VBTRANSCRIPT
![Page 1: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/1.jpg)
Slide 1
VB Graphics Controls& Timer Control
![Page 2: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/2.jpg)
Slide 2
Default Controls
![Page 3: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/3.jpg)
Slide 3
Graphics File Formats used with VB
![Page 4: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/4.jpg)
Slide 4
Using Images
At design time: Select a image thru the Picture property (form, Picture box or Image Box)
At Runtime: Form1.Picture = LoadPicture(“C:\MYPIC.BMP”)Image1.Picture = LoadPicture(“D:\PAMELA.JPG”)Picture1.Picture = image1.PicturePicture1.Picture = LoadPicture(“”)
Passing an empty string to the LoadPicture function clears the current picture.
![Page 5: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/5.jpg)
Slide 5
Using Images with Forms
At design time: Select a form background image thru the Picture property
At Runtime: Form1.Picture = LoadPicture(“C:\MYPIC.BMP”)
picture that is placed directly on a form. If you want the picture to be a different size, you need to resize the original graphic file using a graphics utility.
![Page 6: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/6.jpg)
Slide 6
Using Images with Forms
Placing the picture directly on the form have several drawbacks:
– You cannot hide the picture; it can only be loaded or unloaded.– You cannot control the placement of the picture on the form.– You can place only one picture at a time on the form.– You cannot resize the picture. It’s placed on the form in its
original (saved) size. You can overcome these drawbacks by using the
Picture or Image control.
![Page 7: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/7.jpg)
Slide 7
Image Control Provides a frame for the picture,
allowing you to position it anywhere on the form.
Pictures can be resized. Stretch property:
– False (the default): the Image control is automatically resized to fit the picture you assign to it.
– True: the picture is automatically resized so that the entire picture fits within the current boundaries of the Image control.
![Page 8: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/8.jpg)
Slide 8
PictureBox Control Although the PictureBox control uses more system
resources than the Image control, it has some added features:
– Can be used as a container for other controls– Drawing methods (for example, Line and Print) can be used to
draw on the picture box PictureBox does not allow resizing of the picture Setting AutoSize property to True cause the PictureBox
control to resize itself to fit the current picture.
![Page 9: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/9.jpg)
Slide 9
The Timer Control
Executes code (in its Timer event) when the interval is complete.
Counts down repeatedly, as long as the Enabled property is set to True.
Designed to work with very small amounts of time; the maximum setting is just a little longer than a minute.
Uses: scheduling and performing repeated operations.
![Page 10: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/10.jpg)
Slide 10
Setting Up the Timer
First draw it on the form, it does not show up at all while your program is running.
Place code in the Timer event and then set the following properties, either at designtime or runtime:
– Set the Interval property.– Set the Enabled property to True.The Interval property can be set to any value between zero and
65,535.
![Page 11: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/11.jpg)
Slide 11
The Timer Control
The Enabled property acts like a switch that turns your timer on and off. If the Timer control is enabled, the code in the Timer event is executed at the end of the time specified in the Interval property.
The Interval property can be set to any value between zero (disables the Timer control) and 65,535 milliseconds.
10 seconds = 10,000 milliseconds.
![Page 12: Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls](https://reader036.vdocuments.site/reader036/viewer/2022082419/5a4d1aed7f8b9ab05997c3e4/html5/thumbnails/12.jpg)
Slide 12
Creating a Simple AnimationFollowing is an example of using the timer control for a simple animation. Set the Interval property to 200 and the Enabled property to True.