Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

VC++ 5.0and Floodfill

Can someone give me the proper parameters and usage for Floodfill. I apologize for the spelling in advance.
0
KOCUBA
Asked:
KOCUBA
  • 4
1 Solution
 
nietodCommented:
Answer coming.
0
 
nietodCommented:
This is right from the VC++ online help.

********************************************************
The FloodFill function fills an area of the display surface with the current brush. The area is assumed to be bounded as specified by the crFill parameter.

The FloodFill function is included only for compatibility with earlier versions of Windows. For Win32-based applications, use the ExtFloodFill function with FLOODFILLBORDER specified.

BOOL FloodFill(HDC hdc, // handle to device context
               int nXStart, // x-coordinate, where fill begins
               int nYStart, // y-coordinate, where fill begins
               COLORREF crFill // fill color
);


Parameters

hdc

Identifies a device context.

nXStart

Specifies the logical x-coordinate of the point where filling is to begin.

nYStart

Specifies the logical y-coordinate of the point where filling is to begin.

crFill

Specifies the color of the boundary or of the area to be filled.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Following are reasons this function might fail:

· The fill could not be completed.

· The given point has the boundary color specified by the crFill parameter.

· The given point lies outside the current clipping region ¾ that is, it is not visible on the device.
*************************************************************

In English, this procedure is used to fill an area of a device context with a brush.  The area to be filled is bounded by pixels of a specified color.  If you've used paint programs before, this is kinda like the paint can tool that "pours" paint into an area until it reaches the edges of the area (pixels of a different color).
0
 
nietodCommented:
Note as, the documentation said, These days ExtFloodFill is preferred.  It can be made to worj just like FloodFill, but has other options as well.  (It can be made to work more like a paint can tool.)
0
 
KOCUBAAuthor Commented:
Great info. The reason I had to ask this question was the VC++ help that I have from the Learning Edition does not show the HDC in the parameters. Good thing I asked.
0
 
nietodCommented:
That could be showing an MFC version of floodfill.  MFC defines a class that encapsulates device contexts.  The class has all (most at least) the functions that take HDC's.  But you don't pass an HDC to these functions since they operate on the HDC associated with the object.  Does that makes sense?  It is hard to explain clearly.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now