;

Jumat, 23 Maret 2012

Make a simple Paint program with VB 6

Jumat, 23 Maret 2012

The program covered this time inspired by an innate program Microsoft Windows that is Ms. Paint. This time we will be a little peeling paint program to make it in a simpler version by using Visual Basic.

The first step is to create a project with a form using the object label, button, picture box and frame with a design like this:
Next step is to make arrangements so that the display properties obtained as shown above.

The final step is to provide program listings for the following form:
Dim paintnow As Boolean
Private Sub cmdhapus_Click()
cmdhapus.Enabled = False
cmdpensil.Enabled = True
End Sub
Private Sub cmdhpsemua_Click()
Picture1.Cls
End Sub
Private Sub cmdpensil_Click()
cmdpensil.Enabled = False
cmdhapus.Enabled = True
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 14
lblwarna(i).BackColor = QBColor(i)
Next i
Picture1.ForeColor = QBColor(0)
Picture1.BackColor = QBColor(15)
End Sub
Private Sub lblwarna_Click(Index As Integer)
Picture1.ForeColor = lblwarna(Index).BackColor
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
paintnow = True
Picture1.CurrentX = x
Picture1.CurrentY = y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If paintnow Then
If cmdpensil.Enabled = False Then
Picture1.Line -(x, y), Picture1.ForeColor
Picture1.MousePointer = 99
End If
If cmdhapus.Enabled = False Then
Picture1.Line -(x, y), RGB(255, 255, 255), B
Picture1.MousePointer = 12
End If
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
paintnow = False
End If
End Sub




SHARE FOR ALL

theiyoe - 02.31
-

0 komentar:

Posting Komentar