GRAPHIC EDITOR


AIM:
            To create the Graphic editor program by using Visual basic 6.0.

PROCEDURE: 

            Step 1:  Open the Microsoft Visual basic 6.0.
            Step 2:  To opening New project.
Step 3:  Declared the integer and string variables.
Step 4:   Place the required control to be used in the form they are Picture            box, Command button and scroll bar.
            Step 5:  Type the coding to perform the Graphic editor program.
            Step 6:  To run the program and by using command button to Draw the                             pictures in the Picture box.
            Step 7:  Save the form and project.

SOURCE CODE

Dim a,i As Integer
Dim b As String
Dim x1, y1 As Single

Private Sub Command1_Click(Index As Integer)
a = Index
If a = 1 Then
str = InputBox("Enter the type of rectangle(b or bf)")
End If
If a = 6 Then
End
End If
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
X1 = X
X2 = Y
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If a = 4 Then
Picture1.DrawWidth = 9
Picture1.PSet (X, Y), RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End If
If a = 5 Then
Picture1.DrawWidth = 9
Picture1.PSet (X, Y)
Picture1.ForeColor = Picture1.BackColor
End If
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If a = 1 Then
Picture1.DrawWidth = 12
If str = "B" Or str = "b" Then
Picture1.Line(x1, x2)-(X, Y), RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value), B
Else
Picture1.Line(x1, x2)-(X, Y), RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value),BF
End If
End If
If a = 0 Then
Picture1.DrawWidth = 15
Picture1.Line (x1, x2)-(X, Y), RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End If

If a = 3 Then
For cir = i To 500 Step 100
Picture1.Circle (X, Y), cir, RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Next i
End If
If a = 2 Then
Picture1.DrawWidth = 15
Picture1.Circle ((x1 + X) / 2, (x2 + Y) / 2), (X - a) / 2, RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End If
End Sub

Form Design











Drawing Line,Rectangle






Drawing circle and concentric Circle





0 comments: