by Jim the best (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 5th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Draw shapes and fill them with random colours.
API Declarations
(put this in a module on one line)
Declare Sub FloodFill Lib "GDI32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long)
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
CurrentX = X
CurrentY = Y
If Button = vbRightButton Then
ScaleMode = vbPixels
ForeColor = vbBlack
FillStyle = vbFSSolid
FillColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
FloodFill hDC, X, Y, ForeColor
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
DrawWidth = 1
Line -(X, Y)
End If
End Sub