?
Solved

ExtFloodFill

Posted on 1997-12-15
7
Medium Priority
?
392 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
[X]
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
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
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

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

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