[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ExtFloodFill

Posted on 1997-12-15
7
Medium Priority
?
399 Views
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
0
Comment
Question by:hbadr
  • 5
  • 2
7 Comments
 
LVL 8

Expert Comment

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

'--------------------------DECLARATIONS

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

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
                                   'boundaries.

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]

'-------------------------CODE
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

0
 
LVL 8

Expert Comment

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

Set PicObj.Scalemode = 3 'vbPixels

0
 
LVL 8

Expert Comment

by:mrmick
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
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:hbadr
ID: 1445330
FloodFill PictureBox1, vbWhite, X, Y -> works
FloodFill PictureBox1, vbWhite, X, Y , FLOODFILLSURFACE -> dose nothing
0
 
LVL 8

Accepted Solution

by:
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.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1445332
Whoops,

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)


0
 

Author Comment

by:hbadr
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

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

830 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