Option Explicit 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 FLOODFILLSURFACE = 1 Private Sub Picture1_MouseDown(Button As Integer, Shift As _ Integer, x As Single, y As Single) Dim hBrush&, Col& hBrush = CreateSolidBrush(CLng(RGB(128 * Rnd + 128, 0, 0))) With Picture1 Call SelectObject(.hdc, hBrush) Col = GetPixel(.hdc, x, y) Call ExtFloodFill(.hdc, x, y, Col, FLOODFILLSURFACE) Call DeleteObject(hBrush) End With End Sub