Board index » delphi » Brush.Style - Brush.Color

Brush.Style - Brush.Color

Hi,

in the SetStyle procedure of TBrush the Brush.Color is set to clWhite when the
Brush.Style is bsClear. And when you chose an other color and Brush.Style is
bsClear then it will get bsSolid.
What's the reason for this? It's pretty annoying.

Regards
Kerstin

 

Re:Brush.Style - Brush.Color


Quote
Kerstin Thaler <k.tha...@t-online.de> wrote in message

news:374E7E2D.46200D01@t-online.de...

Quote
> What's the reason for this? It's pretty annoying.

I don't know the reasoning, but it is clearly intentional:

procedure TBrush.SetColor(Value: TColor);
var
  BrushData: TBrushData;
begin
  GetData(BrushData);
  BrushData.Color := Value;
  if BrushData.Style = bsClear then BrushData.Style := bsSolid;
  SetData(BrushData);
end;

- Rick

Re:Brush.Style - Brush.Color


"Rick Rogers (TeamB)" schrieb:
Quote

> I don't know the reasoning, but it is clearly intentional:

Yes, obviously it's intentional :)
And to comment out the two lines (in SetStyle and SetColor) has ugly effects in
other components, I tried TBitBtn. But shouldn't there have been other ways than
to force the change in a protected procedure of TBrush. Wasn't it better to
chose freely what you need when you're using the Brush?

Kerstin

Re:Brush.Style - Brush.Color


So why don't you build it then... Just add a property and default to check...
Quote
Kerstin Thaler wrote:
> "Rick Rogers (TeamB)" schrieb:

> > I don't know the reasoning, but it is clearly intentional:

> Yes, obviously it's intentional :)
> And to comment out the two lines (in SetStyle and SetColor) has ugly effects in
> other components, I tried TBitBtn. But shouldn't there have been other ways than
> to force the change in a protected procedure of TBrush. Wasn't it better to
> chose freely what you need when you're using the Brush?

> Kerstin

Re:Brush.Style - Brush.Color


Number 7...

{*******************************************************}
{                                                       }
{       Borland Delphi Visual Component Library         }
{                                                       }
{       Copyright (c) 1995,98 Inprise Corporation       }
{                                                       }
{*******************************************************}

Have a great Delphi day!

Joe
--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Re:Brush.Style - Brush.Color


Sorry, I forgot that you are a legally recongized
authorized agent of the Inprise corporation.

Joe
--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Re:Brush.Style - Brush.Color


Quote
Kerstin Thaler <k.tha...@t-online.de> wrote in message

news:374E7E2D.46200D01@t-online.de...

Quote

> in the SetStyle procedure of TBrush the Brush.Color is set to clWhite
when the
> Brush.Style is bsClear. And when you chose an other color and
Brush.Style is
> bsClear then it will get bsSolid.
> What's the reason for this? It's pretty annoying.

This seems to me to be by design. If you specify a color to a brush you
obviously want the color to appear don't you? Why would you want a green
hollow brush?

Bill

Other Threads