Posted on 1997-12-15
Last Modified: 2011-10-03
I can't get ExtFloodFill to fill an area bounded by more than one color ,using the FLOODFILLSURFACE parameter , I need an example along with the correct property settings ( scalemode , fillcolor, ... etc.) thanks
Question by:hbadr
  • 5
  • 2

Expert Comment

ID: 1445327
Place the following Declarations in a code module.


Public Const FLOODFILLBORDER& = 0  'The fill area is bounded by the
                                   'color specified by the FillColor

Public Const FLOODFILLSURFACE& = 1 'The fill area is defined by the
                                   'color that is specified by FillColor.
                                   'Filling continues outward in all
                                   'directions as long as the color is
                                   'encountered. This style is useful for
                                   'filling areas with multicolored

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

'-------------------------END OF DECLARATIONS

Use the following VB Procedure as follows:

FloodFill PictureBox1, vbWhite, X, Y [, FLOODFILLSURFACE]

Sub FloodFill(PicObj As Object, ByVal FillColor As Long, ByVal X As Long, ByVal Y As Long, Optional FillType As Long = 0)

   Dim RC As Long 'Return Code

   PicObj.FillStyle = vbSolid ' = 0
   PicObj.FillColor = FillColor
   RC = ExtFloodFill(PicObj.hDC, X, Y, 0&, FillType)

End Sub
'-------------------------END OF CODE


Expert Comment

ID: 1445328
Woops, also add this line...

Set PicObj.Scalemode = 3 'vbPixels


Expert Comment

ID: 1445329
Whoops again,

With out the set, I started to tell you to set the scalemode to 3, and then changed my mind to give the code as an example...

PicObj.Scalemode = vbPixels ' 3
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.


Author Comment

ID: 1445330
FloodFill PictureBox1, vbWhite, X, Y -> works
FloodFill PictureBox1, vbWhite, X, Y , FLOODFILLSURFACE -> dose nothing

Accepted Solution

mrmick earned 100 total points
ID: 1445331
Then the surface isn't of the color white, Check the color of the surface you're trying to fill.  This works perfect for me.

Expert Comment

ID: 1445332

In my program, the color I'm filling is always white.  I use it for printed graphics.  If you wish to fill an area of a color other than white, you'll need to pass the color to the procedure and change the following  line:

RC = ExtFloodFill(PicObj.hDC, X, Y, ReplaceColor, FillType)


Author Comment

ID: 1445333
I already did that using

Sub FloodFill(PicObj As Object, ByVal FillColor As Long, ByVal x As Long, ByVal y As Long, Optional FillType As Long = 0)

Dim RC As Long 'Return Code
PicObj.ScaleMode = vbPixels ' 3
PicObj.FillStyle = vbSolid ' = 0
PicObj.FillColor = FillColor
RC = ExtFloodFill(PicObj.hdc, x, y, PicObj.Point(x, y), FillType)
End Sub

but i didn't specify that the color I wanted to fill was WHITE in my question ,thats why i didn't grade you A.
                             Lot Of Thanks


Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now