Wednesday, May 27, 2009

The Circle Method,uses a common dialog box

The Circle Method

The circle method takes the following format

Circle (x1, y1), radius, color

That draws a circle centered at (x1, y1), with a certain radius and a certain border color. For example, the procedure

Circle (400, 400), 500, VbRed

draws a circle centered at (400, 400) with a radius of 500 twips and a red border.

---------
example
uses a common dialog box here to perform some of the jobs which could be difficult to perform . In this program, a user have to fill in all the coordinates and choose a color before he can proceed to draw the required shape. If one forget to fill in the coordinates or choose a color, he will be asked to do so.

Private Sub Command2_Click()
x1 = Text1.Text
y1 = Text2.Text
x2 = Text3.Text
y2 = Text4.Text
Picture1.Line (x1, y1)-(x2, y2), color, B
End Sub

Private Sub Command3_Click()
CommonDialog1.Flags = &H1&
CommonDialog1.ShowColor
color = CommonDialog1.color

End Sub

Private Sub Command4_Click()
On Error GoTo addvalues
x3 = Text5.Text
y3 = Text6.Text
r = Text7.Text
Picture1.Circle (x3, y3), r, color
Exit Sub

addvalues:
MsgBox ("Please fill in the coordinates ,the radius and the color")

End Sub

Private Sub Command5_Click()
Picture1.Cls
End Sub

Private Sub Command6_Click()
x1 = Text1.Text
y1 = Text2.Text
x2 = Text3.Text
y2 = Text4.Text
Picture1.Line (x1, y1)-(x2, y2), color, BF
End Sub

No comments:

Post a Comment