Agosto 30, 2007
Pizarra para dibujar con el ratón (Visual Basic)
Posted by japerfer under Programación, Visual BasicAplicación para que dibujen los más peques de la casa.
Código del único Formulario:
Option Explicit
Dim Click As Boolean
Dim ColorTiza As Integer
Private Sub Form_Load()
ColorTiza = 15 ‘Color blanco por defecto al abrir el programa
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Click = True
Picture1.PSet (X, Y), QBColor(ColorTiza)
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Click = True
Picture1.Line -(X, Y), QBColor(ColorTiza)
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Click = False
End If
End Sub
Private Sub BotonVerdeOscuro_Click(Index As Integer)
ColorTiza = 2 ‘Color Verde Oscuro
End Sub
Private Sub BotonRojo_Click(Index As Integer)
ColorTiza = 4 ‘Color Rojo Claro
End Sub
Private Sub BotonGris_Click(Index As Integer)
ColorTiza = 8 ‘Color gris
End Sub
Private Sub BotonAzul_Click(Index As Integer)
ColorTiza = 9 ‘Color Azul Marino
End Sub
Private Sub BotonVerdeClaro_Click(Index As Integer)
ColorTiza = 10 ‘Color Verde Claro
End Sub
Private Sub BotonRosa_Click(Index As Integer)
ColorTiza = 13 ‘Color Rosa
End Sub
Private Sub BotonAmarillo_Click(Index As Integer)
ColorTiza = 14 ‘Color Amarillo
End Sub
Private Sub BotonBlanco_Click(Index As Integer)
ColorTiza = 15 ‘Color blanco
End Sub
Private Sub BotonBorrar_Click()
Picture1.Cls
End Sub
Private Sub BotonSalir_Click()
End
End Sub
Puedes descargarte el ejecutable aquí.