|
-
Aug 6th, 2001, 01:41 PM
#1
Thread Starter
Hyperactive Member
UnCreate Solid Brush??
I'm using CreateSolidBrush API for FloodFill affect. I was using the circle method to make some circles with the center transparent. After using Floodfill the circle is always filled with the backcolor of the form. Unfortunately the Circle method appears to have the same DC as the Window it's in so if I delete the brush I can't draw anymore on the window. So how do I make the brush transparent again. I can't do this through the circle method - it won't allow it now that I have created a "solid" brush. Can anyone figure this out?
-
Aug 7th, 2001, 03:16 AM
#2
Member
I haven't used the API CreateBrushes-related calls, but I found a way to use FloodFillExt without needing brushes ... So, this might not be the answer you wanted, but it might give you an additional work-around.
Here's how it goes (thanks to an old VB3 example on MSDN) ...
The declaration goes like so:
Code:
Public 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
Before you call the thing, you'll want to set the .FillColor and .FillStyle parameters on the obect your going to be filling -- It uses those parameters to do the filling.
Then, call the function, with the following parameter definitions:
+ hdc = the .hDC of the object you wish to fill
+ X & Y = the location of the pixel to start the fill at
+ crColor = the "given color" parameter, which is treated differently depending on the last parameter ...
+ wFillType = either 0 or 1 with the following results:
> > 0 = crColor is the border color ... this will fill across *all* colors until a border of crColor is reached
> > 1 = crColor is the color to be replaced ... this will fill over just crColor until any different color is reached
So, a typical call would be:
Code:
Picture1.FillColor = RGB(255,0,0) 'bright red
Picture1.FillStyle = 0 'solid
ExtFloodFill Picture1.hDC, 50, 50, Picture1.Point(50,50), 1
This will start the flood fill on the pixel at location (50, 50), replacing whatever color was there with red until another color is found ... I guess for you, this would mean you'd draw the circle, then call the fill routine at a point within the circle.
Hope that helps,
-Bryk
-
Aug 7th, 2001, 08:23 AM
#3
transcendental analytic
SelectObject the old brush again, the one that was returned at the earlier SelectObject call
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|