Declare Function ExtFloodFill Lib "gdi32.dll" (ByVal hdc As Long, ByVal nXStart As Long, ByVal nYStart As Long, ByVal crColor As Long, ByVal fuFillType As Long) As Long
ExtFloodFill performs a flood fill operation on a device using that device's currently selected brush. The flood fill begins at a single point and extends in all directions until a condition is met. The flood fill can extend either until a certain boundary color is reached or while a certain color is being filled over.
If an error occured, the function returns 0 (Windows NT, 2000: use GetLastError to get the error code). If successful, the function returns a non-zero value.
None.
Const FLOODFILLBORDER = 0 Const FLOODFILLSURFACE = 1
' This code is licensed according to the terms and conditions listed here. ' Draw a solid green ellipse on window Form1 and fill ' the area outside of it with a diagonally cross-hatched red brush. Dim hPen As Long, hBrush As Long ' handles to the pen and brush to be used Dim hOldPen As Long, hOldBrush As Long ' handles to the previously selected objects Dim retval As Long ' return value ' Create a solid green pen with a width of one pixel. hPen = CreatePen(PS_SOLID, 0, RGB(0, 255, 0)) ' Select it for use in Form1, noting the previous pen. hOldPen = SelectObject(Form1.hDC, hPen) ' Create a blue diagonally cross-hatched brush. hBrush = CreateHatchBrush(HS_DIAGCROSS, RGB(0, 0, 255)) ' Select it for use in Form1, noting the previous brush. hOldBrush = SelectObject(Form1.hDC, hBrush) ' Draw an ellipse with bounding rectangle (100,150)-(350, 250) retval = Ellipse(Form1.hDC, 100, 150, 350, 250) ' Flood fill the area outside the ellipse (use a green boundary) ' starting at the point (25,30) outside the ellipse. retval = ExtFloodFill(Form1.hDC, 25, 25, RGB(0, 255, 0), FLOODFILLBORDER) ' Select the previously selected pen and brush. retval = SelectObject(Form1.hDC, hOldPen) retval = SelectObject(Form1.hDC, hOldBrush) ' Delete the pen and brush to free up resources. retval = DeleteObject(hPen) retval = DeleteObject(hBrush)
Bitmaps
Go back to the alphabetical Function listing.
Go back to the Reference section index.
Last Modified: October 17, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/e/extfloodfill.html