Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Dim color As Long
Dim brush As Long
Dim old_brush As Long
' Pick a random color other than black and
' the point's current color.
Do
color = QBColor(Int(15 * Rnd + 1))
Loop While color = Point(X, Y)
' Create and select a brush of this color.
brush = CreateSolidBrush(color)
old_brush = SelectObject(hdc, brush)
' Do the flood,stopping when we
' reach black pixels.
FloodFill hdc, X, Y, vbBlack
' Select the old brush and delete the new one.
brush = SelectObject(hdc, old_brush)
DeleteObject brush
Refresh
End Sub
|