The information in this article applies to:
SUMMARY
You can fill an area on a window in Visual Basic through a Windows API
function call. Depending on the type of fill to be performed, you can
use the ExtFloodFill function to achieve the desired effect. This
feature is similar to the paint feature found in painting programs.
MORE INFORMATION
The Windows API ExtFloodFill function call fills an area of the
display surface with the current brush, as shown in the example below.
Code ExampleFrom the VB.EXE Code menu, choose View Code, and enter the following code (on just one line) for Form1 (using [general] from the Object box and [declarations] from the Procedure box):
To demonstrate several fill examples, create a picture box called Picture1. Set the following properties:
Create a push button in a location that will not be overlapped by Picture1. Within the Click event, create the following code:
When you click the push button, the black background will change to the FillColor. The fill area is defined by the color specified by crColor&. Filling continues outward from (X%,Y%) as long as the color is encountered. Now change the related code to represent the following:
Executing the push button will now fill the area until crColor& is encountered. In the first example, the fill was performed while the color was encountered; in the second example, the fill was performed while the color was not encountered. In the last example, everything is changed except the "floating pawn". Additional query words: 2.00 3.00
Keywords : |
Last Reviewed: June 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |