Solved

ExtFloodFill

Posted on 1997-12-15
7
389 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 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.
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

738 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