J
Jeanh
Guest
Thans and Credit to : PGs
Paint software in visual basic is simple paint program which is capable of drawing simple figures and coloring them. It has some features like spray color , pencil , picture draw options
Question :
Design and Develop features of Paint Brush application.
DOWNLOAD LINK==>> You do not have permission to view the full content of this post. Log in or register now.
Paint software in visual basic is simple paint program which is capable of drawing simple figures and coloring them. It has some features like spray color , pencil , picture draw options
Question :
Design and Develop features of Paint Brush application.
Code:
d Develop features of Paint Brush application.
Dim sx, sy As Single
Dim px As Integer
Dim py As Integer
Dim flag As Integer
Private Sub spray(X As Single, Y As Single, col As ColorConstants)
Dim i As Integer
Dim tempx As Integer
Dim tempy As Integer
For i = 1 To 10 Step 1
tempx = Rnd * 50
tempy = Rnd * 50
fradraw.PSet (X + tempx, Y + tempy), col
Next i
End Sub
Private Sub Form_Activate()
sx = 0
sy = 0
End Sub
Private Sub fradraw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 0 Then
sx = X
sy = Y
End If
End Sub
Private Sub fradraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim col As ColorConstants
If Button = 1 Then
col = piccur(1).BackColor
ElseIf Button = 2 Then
col = piccur(0).BackColor
End If
If Button <> 0 Then
Select Case flag
Case 1
Call spray(X, Y, col)
Case 2
Case 3
fradraw.Line (sx, sy)-(X, Y), col
sx = X
sy = Y
Case 4
fradraw.Line (sx, sy)-(px, py), vbWhite
fradraw.Line (sx, sy)-(X, Y), col
px = X
py = Y
Case 5
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
fradraw.Line (sx, sy)-(X, sy), col
fradraw.Line (X, sy)-(X, Y), col
fradraw.Line (X, Y)-(sx, Y), col
fradraw.Line (sx, Y)-(sx, sy), col
px = X
py = Y
Case 6
Case 7
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
fradraw.Line (sx, sy)-(X, sy), col
fradraw.Line (X, sy)-(X, Y), col
fradraw.Line (X, Y)-(sx, Y), col
fradraw.Line (sx, Y)-(sx, sy), col
px = X
py = Y
Case 8
fradraw.Circle (Abs((sx + px) / 2), Abs((sy + py) / 2)), Abs((sx - px) / 2), vbWhite
fradraw.Circle (Abs((sx + X) / 2), Abs((sy + Y) / 2)), Abs((sx - X) / 2), col
px = X
py = Y
End Select
End If
End Sub
Private Sub fradraw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim a As String
Select Case flag
Case 7
a = InputBox("Enter a string", "String Input")
fradraw.ScaleMode = vbPixels
fradraw.CurrentX = sx + 10
fradraw.CurrentY = sy + 20
fradraw.Print a
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
End Select
End Sub
Private Sub mnuclrimg_Click()
fradraw.Cls
End Sub
Private Sub mnuexit_Click()
End
End Sub
Private Sub piccol_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
piccur(0).BackColor = piccol(Index).BackColor
End If
If Button = 1 Then
piccur(1).BackColor = piccol(Index).BackColor
End If
End Sub
Private Sub pictool_Click(Index As Integer)
Select Case Index
Case 0
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 0
Case 1
fradraw.MouseIcon = LoadPicture("SELECT.CUR")
flag = 1
Case 2
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 0
Case 3
fradraw.MouseIcon = LoadPicture("PENCIL.CUR")
flag = 3
Case 4
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 4
Case 5
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 5
Case 6
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 6
Case 7
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 7
Case 8
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 8
End Select
End Sub
Private Sub pictool_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
pictool(Index).BorderStyle = 1
End Sub
Private Sub pictool_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
pictool(Index).BorderStyle = 0
End Sub
Dim sx, sy As Single
Dim px As Integer
Dim py As Integer
Dim flag As Integer
Private Sub spray(X As Single, Y As Single, col As ColorConstants)
Dim i As Integer
Dim tempx As Integer
Dim tempy As Integer
For i = 1 To 10 Step 1
tempx = Rnd * 50
tempy = Rnd * 50
fradraw.PSet (X + tempx, Y + tempy), col
Next i
End Sub
Private Sub Form_Activate()
sx = 0
sy = 0
End Sub
Private Sub fradraw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 0 Then
sx = X
sy = Y
End If
End Sub
Private Sub fradraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim col As ColorConstants
If Button = 1 Then
col = piccur(1).BackColor
ElseIf Button = 2 Then
col = piccur(0).BackColor
End If
If Button <> 0 Then
Select Case flag
Case 1
Call spray(X, Y, col)
Case 2
Case 3
fradraw.Line (sx, sy)-(X, Y), col
sx = X
sy = Y
Case 4
fradraw.Line (sx, sy)-(px, py), vbWhite
fradraw.Line (sx, sy)-(X, Y), col
px = X
py = Y
Case 5
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
fradraw.Line (sx, sy)-(X, sy), col
fradraw.Line (X, sy)-(X, Y), col
fradraw.Line (X, Y)-(sx, Y), col
fradraw.Line (sx, Y)-(sx, sy), col
px = X
py = Y
Case 6
Case 7
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
fradraw.Line (sx, sy)-(X, sy), col
fradraw.Line (X, sy)-(X, Y), col
fradraw.Line (X, Y)-(sx, Y), col
fradraw.Line (sx, Y)-(sx, sy), col
px = X
py = Y
Case 8
fradraw.Circle (Abs((sx + px) / 2), Abs((sy + py) / 2)), Abs((sx - px) / 2), vbWhite
fradraw.Circle (Abs((sx + X) / 2), Abs((sy + Y) / 2)), Abs((sx - X) / 2), col
px = X
py = Y
End Select
End If
End Sub
Private Sub fradraw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim a As String
Select Case flag
Case 7
a = InputBox("Enter a string", "String Input")
fradraw.ScaleMode = vbPixels
fradraw.CurrentX = sx + 10
fradraw.CurrentY = sy + 20
fradraw.Print a
fradraw.Line (sx, sy)-(px, sy), vbWhite
fradraw.Line (px, sy)-(px, py), vbWhite
fradraw.Line (px, py)-(sx, py), vbWhite
fradraw.Line (sx, py)-(sx, sy), vbWhite
End Select
End Sub
Private Sub mnuclrimg_Click()
fradraw.Cls
End Sub
Private Sub mnuexit_Click()
End
End Sub
Private Sub piccol_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
piccur(0).BackColor = piccol(Index).BackColor
End If
If Button = 1 Then
piccur(1).BackColor = piccol(Index).BackColor
End If
End Sub
Private Sub pictool_Click(Index As Integer)
Select Case Index
Case 0
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 0
Case 1
fradraw.MouseIcon = LoadPicture("SELECT.CUR")
flag = 1
Case 2
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 0
Case 3
fradraw.MouseIcon = LoadPicture("PENCIL.CUR")
flag = 3
Case 4
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 4
Case 5
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 5
Case 6
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 6
Case 7
fradraw.MouseIcon = LoadPicture("NORMAL01.CUR")
flag = 7
Case 8
fradraw.MouseIcon = LoadPicture("CROSS02.CUR")
flag = 8
End Select
End Sub
Private Sub pictool_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
pictool(Index).BorderStyle = 1
End Sub
Private Sub pictool_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
pictool(Index).BorderStyle = 0
End Sub
DOWNLOAD LINK==>> You do not have permission to view the full content of this post. Log in or register now.
Last edited by a moderator: