Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
Const FLOODFILLBORDER = 0 ' Fill until crColor& color encountered.
Const FLOODFILLSURFACE = 1 ' Fill surface until crColor& color not encountered.
Const crNewColor = &HFFFF80
Dim mBrush As LongPrivate Sub Command1_Click()
    Picture1.Circle (50, 50), 20End SubPrivate Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
End Sub
Private Sub Form_Unload(Cancel As Integer)
    'Delete our new brush
    DeleteObject mBrush
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    'Create a solid brush
    mBrush = CreateSolidBrush(crNewColor)
    'Select the brush into the PictureBox' device context
    SelectObject Picture1.hdc, mBrush
    'API uses pixels
    Picture1.ScaleMode = vbPixels
    'Floodfill...
    
    ExtFloodFill Picture1.hdc, x, y, GetPixel(Picture1.hdc, x, y), FLOODFILLSURFACE
End Sub