Board index » delphi » Help: Problem with FillRect for Tcanvas.Brush.Style

Help: Problem with FillRect for Tcanvas.Brush.Style

When using the FillRect method of a TCanvas object, a rectangle is
drawn, filled in with the Canvas'es TBrush object's style, color etc.
Setting the Tcanvas.Brush.Style other than bsSolid (bsDiagCross fior
example) is supposed to cause the brush to paint its Color onto the
rectangle in the specified color, according to the pattern specified
What happens to the pixels in between the pattern though is not
clearly defined. In my experience, these pixels have not been affected
(ie in between a DiagCross pattern, the previous color was left
undisturbed ) Suddenly now in my app, the in-between pixels are
painted black (ie the DiagCross pattern appears fine, but the
background color is not as I left it, but black). How is this
background color specified? I can't find a property anywhere that
specifies this. (I have set the Tcanvas.CopyMode to cmSrcCopy) (When
Brush.Style is set to bsClear the original color IS left undisturbed)

Any help?
Thanks in advance.
Dave
i...@global.co.za

 

Re:Help: Problem with FillRect for Tcanvas.Brush.Style


There is a quirk in many of the window95 video drivers verses what windows
3.1
would do.
 I also had the same problem..
 The Brush color sets the patern , how ever, you may find that the color
file
in is not correct!, in most cases the file in color is and Xor of the Brush
color.
this means if your brush is white, your fill in will be black,,,

 To correct the problem, i had to use API calls on the canvas.handle..
SetBkmode, SetBkColor..
 you want your bakground non-transparent and your color to what ever you
want
by using the above API calls., when this is done you then do your
Brush fill ect....

Quote
> painted black (ie the DiagCross pattern appears fine, but the
> background color is not as I left it, but black). How is this
> background color specified? I can't find a property anywhere that
> specifies this. (I have set the Tcanvas.CopyMode to cmSrcCopy) (When
> Brush.Style is set to bsClear the original color IS left undisturbed)

> Any help?
> Thanks in advance.
> Dave
> i...@global.co.za

Other Threads