CCP503
CCP503
ANDHRA PRADESH
Name : Nand Kishore Singh
Designation : Lecturer
Branch : D.C.C.P.
Institute : SGM G.P.T., Abdullapurmet
Year/Semester : V Semester
Subject : VISUAL BASIC-I
Subject Code : CCP-503
Topic : MDI Applications and Graphics
Duration : 50 Mts
Sub-Topic : Graphics – Miscellaneous
Teaching Aids used : PPT, Animations, Window
outputs
CCP503.60 1
Duration to cover each Objective
Recap 05 Min
Paint picture method 05 Min
Use of Paint picture method 05 Min
Differences between Picture & Image controls 05 Min
Examples on Dots, Line & Circle methods 10 Min
Examples on Line and Shape controls 10 Min
Summary 05 Min
Quiz and Questions 05 Min
CCP503.60 2
Objectives
On completion of this period, you will be
able to:
Know and Use Paintpicture method
Know Differences between Picture & Image
controls
Solve difficult assignments on dot, line and
circle methods
Solve difficult questions on line and shape
controls
CCP503.60 3
Recap
CCP503.60 4
Paintpicture() method
Definition:
Paintpicture() is a method of forms & printer objects to
send the contents of PictureBox to printer and other
forms.
Syntax:
Destination.Paintpicture Source, x, y, picture,
dest.height, dest.width
CCP503.60 5
Explanation:
CCP503.60 6
Use of Paintpicture method
Explanation:
Create Two forms named ‘Form1’ and ‘Form2’
Paste a Picture control on Form1 and load a
picture on it
Write the following code for form click events as
follows:
Form1
Form1_click
Form2.show
End Sub
CCP503.60 7
Form2:
Form2_Click
Form2.Paintpicture Form1.Picture1,0,0,
Form2.width/2,Form2.height/2
End Sub
CCP503.60 11
Examples of Dots, Lines & Circles-II
CCP503.60 14
Examples on Lines & Shape Controls
CCP503.60 15
General code:
Dim k(7) As String
Dim i As Long
For Form_load event
Private Sub Form_Load()
k(0) = vbRed
k(1) = vbGreen
k(2) = vbBlue
k(3) = vbMagenta
k(4) = vbCyan
k(5) = vbBlack
k(6) = vbYellow
i=0
End Sub
CCP503.60 16
Private Sub Timer1_Timer()
If i > 6 Then
i=0
End If
x=i*6
If x = 0 Then
x=1
End If
Line1.BorderColor = k(i)
Line1.BorderWidth = x
y=i+1
If y > 5 Then
y=0
End If
Shape1.Shape = y
Shape1.BorderColor = y
Shape1.FillStyle = y
Shape1.FillColor = k(y)
i=i+1
End Sub
CCP503.60 17
SUMMARY
Paintpicture() method
CCP503.60 18
Quiz – Objective Type
2.
False
Image control acts as a container (T/F)_______
3. The property that allows changing the image size in image control
Stretch
is_____________
False
4. The default value of Stretch property is________
Load picture()
5. The method to show a picture in Image control is__________
False
6. The image control allows drawing of graphics on it (T/F)_____
CCP503.60 19
Frequently Asked Questions
1. Explain difference between Picture and Image control
2. Explain Paint Picture methods with a example
CCP503.60 20
Assignment
CCP503.60 21
Thank You
CCP503.60 22