Académique Documents
Professionnel Documents
Culture Documents
ANDHRA PRADESH
Name : M.H.Prasad Rao
Designation : HCCP
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 – Circle method
Teaching Aids used : PPT, Animations, Window
outputs
CCP503.55 1
Objectives
On completion of this period, you would
be able to:
Know about circles & how to draw them
Know syntax & use of Circle() method
Drawing simple circles with direct values
Drawing circles with variables and loops
Using Circle() Method with STEP parameter
Using Circle() Method with COLOR
parameter
CCP503.55 2
Recap on methods
Form and its methods to draw graphics
Pset() and Line() methods
Linkage with Circle() Method
CCP503.55 3
Introduction to Circles
Definition:
1. A circle is a round line drawn equidistant from a point
in the centre. The center point is indicated by x,y
coordinates.
2. A circle can be drawn with Circle() method of Form
control or Picture Box control.
CCP503.55 4
Circle method
CCP503.55 5
Introduction to Circles
Fig:1
CCP503.55 6
Syntax and Explanation of Circle()
Method
Syntax:
Form1.Circle [step] (IntX1,IntY1),radius,[color],p1,p2,aspect
• IntX1, IntY1 are the coordinates of circle’s center point
• step specifies the relative coordinate values.
CCP503.55 7
Syntax and Explanation of Line()
Method continuation..
CCP503.55 8
Drawing simple circles
Example:
Form1.Circle(2000,2000),1000
Draws a simple circle on the form as shown in
the picture at a point whose coordinates are
2000(x),2000(y) and whose radius is 1000 twips
CCP503.55 9
Drawing simple circles
Fig:2
CCP503.55 10
Drawing Circles with variables and
loops-I
Explanation: In place of coordinate values of point
around which circle is drawn and radius, variables can
be used so that user can control the position and size of
circles
CCP503.55 11
Drawing Circles with variables and
loops-I
Examples:
x = InputBox("Give x value")
y = InputBox("Give y value")
r = InputBox(“Give size of radius")
Form1.Circle (x, y), r
First three instructions ask for x,y and radius
values and Circle method draws the circle as per
the given values
CCP503.55 12
Drawing Circles with variables and
loops-I
Fig:3
CCP503.55 13
Drawing Circles with variables and
loops-II
Explanation: Using variables and loops a series of
circles can be drawn
CCP503.55 14
Drawing Circles with variables and
loops-II
Example:
x = 500
y = 500
r = 150
For i = 1 To 10
Form1.Circle (x, y), r
x = x + 200
y = y + 200
r = r + 60
Next i
CCP503.55 15
Drawing Circles with variables and
loops-II
Fig:4
CCP503.55 16
Drawing Circles with STEP parameter
Explanation:
STEP parameter helps in drawing circles
from previously drawn circle’s center point
CCP503.55 17
Drawing Circles with STEP parameter
Example:
Form1.Circle (2000, 1500), 100
For i = 1 To 10
Form1.Circle Step(0, 100), 100
Next I
Draws 10 circles by increasing y (vertical)
coordinate of the center point of the first
circle keeping the x (horizontal) coordinate
same
CCP503.55 18
Drawing Circles with STEP parameter
Fig:5
CCP503.55 19
Drawing Circles with color parameter
Explanation: Circles can be drawn in desired
color by setting COLOR parameter of Circle()
method
CCP503.55 20
Drawing Circles with color parameter
Example:
Form1.Circle (2000, 1500), 100, vbRed
Form1.Circle Step(0, 0), 200, vbYellow
CCP503.55 21
Drawing Circles with color parameter
Fig:6
CCP503.55 22
Summary
Knowledge of Circle() method
CCP503.55 23
Quiz – Objective Type
1. The method used to draw a circle is______
Circle()
2. One
______set of x, y coordinates is/are required to
draw a circle.
CCP503.55 24
Quiz – Objective Type
radius
2. ________ parameter of Circle() method determines
size of a circle.
CCP503.55 25
Quiz – Objective Type