Posted on 1997-12-15
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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

Accepted Solution

mrmick earned 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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