hbadr
asked on
ExtFloodFill
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
Woops, also add this line...
Set PicObj.Scalemode = 3 'vbPixels
Set PicObj.Scalemode = 3 'vbPixels
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
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
ASKER
FloodFill PictureBox1, vbWhite, X, Y -> works
FloodFill PictureBox1, vbWhite, X, Y , FLOODFILLSURFACE -> dose nothing
FloodFill PictureBox1, vbWhite, X, Y , FLOODFILLSURFACE -> dose nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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)
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)
ASKER
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
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
'-------------------------
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
'-------------------------
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
'-------------------------