ExtFloodFill to fill regions with color 
Author Message
 ExtFloodFill to fill regions with color

Quote:

>I have since found out that one can use Get Focus() and GetDC%() calls to
>get the DC of any particular control, whether or not it has a hDC property.

>*BUT*, I cannot grasp how to determine and set the value of the Fill
>Color. In a good many controls there is a FillColor property. But suppose
>I want to set this for a control which doesn't have this property?

To set the color used by ExtFloodFill, select a brush into the DC
with the SelectObject API function.  You can obtain brush handles
from CreateSolidBrush, CreatePatternBrush, etc. or from GetStockObject.
If you create a new brush, be sure to destroy it with DeleteObject
after releasing the DC.

_____________________________________________________________________
Jason Simmons               Author of VBScript - a scripting language

                (ftp.cica.indiana.edu : programr/vbasic/vbscript.zip)



Sun, 10 Aug 1997 13:29:14 GMT  
 ExtFloodFill to fill regions with color
*question regarding flooding a region with color using API*

I've been entranced with trying to use the API to fill areas on a map
that users have clicked on, and events which proceed from there

One problem, using both HotMap and ZZHot vbx's, is that altho their "hot"
regions identify correctly, the procedure for painting them is SLOW as
molasses -- not to mention that one is filling in the hot region and not
the map area itself. Depending on how many points you used to define the
region in the first place this might or might not look good.

Here's my question:  I'm using an adaption of the ExtFloodFill API
function to fill an area with color. The KB describes this technique in
nice detail, but with regard to a PictureBox with has a hDC property
already built it.

I have since found out that one can use Get Focus() and GetDC%() calls to
get the DC of any particular control, whether or not it has a hDC property.

*BUT*, I cannot grasp how to determine and set the value of the Fill
Color. In a good many controls there is a FillColor property. But suppose
I want to set this for a control which doesn't have this property?

I figure it has something to do with the GetBrush() function or something
like that but I can't quite understand what to do next.

Thanks for your help



Sun, 10 Aug 1997 04:08:50 GMT  
 ExtFloodFill to fill regions with color
|> *question regarding flooding a region with color using API*

|> Here's my question:  I'm using an adaption of the ExtFloodFill API
|> function to fill an area with color. The KB describes this technique in
|> nice detail, but with regard to a PictureBox with has a hDC property
|> already built it.

BOOL ExtFloodFill(
    HDC hdc, // handle of device context
    int nXStart, // x-coordinate where filling begins
    int nYStart, // y-coordinate where filling begins
    COLORREF crColor, // fill color
    UINT fuFillType // fill type
   );  

I guess all the parameters are clear, except the COLORREF crColor.

You should use the function crColor=RGB(r,g,b) prior to this function.

If there's something else you'd need to know, I'd be glad to help you.

Take care,
Sabina



Wed, 13 Aug 1997 03:49:58 GMT  
 ExtFloodFill to fill regions with color
|> *question regarding flooding a region with color using API*
|> I want to set this for a control which doesn't have this property?

Ops, I missed that out.

If it doesn't have the COLORREF parameter, it ussually has the hBrush one.
And if it does not, than it usses "current" brush, which you can create with

hBrush=CreateSolidBrush(RGB(255,0,0))  to create logical red brush
oldObj=SelectObject(hDC,hBrush)
...
...
...
SelectObject(hDC,oldObj)
DeleteObject(hBrush)

Take care,
Sabina



Wed, 13 Aug 1997 03:55:24 GMT  
 ExtFloodFill to fill regions with color
I am trying to copy the contents of Picture (on which I have drawn
some graphics with Line and Print) to the clipboard as a bitmap:

  ClipBoard.Clear
  ClipBoard.SetData Picture1.Image

When the picture control is small (say 2 inches square, the clipboard image
is fine.  However when it is larger, (say 4x8 inches on screen) the
image is scrambled (portions are horizontally displaced, although the
whole image seems to be there).

When I make a BMP file of the same image, it looks fine (undamaged)
when loaded into Paintbrush (the BMP file is approx 220K bytes).

  SavePicture Picture1.Image, "Test.BMP"

When I do the following:

  Picture1.Picture = Picture1.Image

the picture control also shows the same scrambled image, so it is
probably not the Clipboard that is mangling the image.

Is this a well known bug, or have I missed something?  The Picture
has AutoRedraw set to True and ClipControls set to False, but I have
tried other settings without solving the problem.

Thanks for the help.

Hans J. Reich



Thu, 14 Aug 1997 01:14:37 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ExtFloodFill and Custom Colors

2. Filling regions in a picture box

3. Fill region

4. Filling regions on printer object

5. Filling regions on printer object

6. Fill Region

7. Filling a region with text

8. Drawing Polygon Filled Region in VB5

9. Filling the picture box eith the color of a common dialog selected color

10. VB5/gdi32, Q: how can i make a Region of a color

11. VB5/gdi32, Q: how can i make a Region of a color

12. how to color a region difined by many points

 

 
Powered by phpBB® Forum Software