Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Shape Color

edited March 2004 in General
Hi,

I need to change the background color on a shape in a subreprt.
I have tried with the DBText.OnPrint event

if DBText22.FieldValue < 0 then
Shape4.Brush.Color := clRed;
if DBText22.FieldValue > 0 then
Shape4.Brush.Color := clWhite;

But all shapes in the subreports is colored red.

Any ideas?

/Ronny

Comments

  • edited March 2004
    2 tings (without testing): Try setting the color of the shape in the shapes
    OnPrint. Also, set the Brush.Style value. e.g.:

    procedure TForm1.ppShape1Print(Sender: TObject);
    begin
    if ppDBText1.FieldValue < 0 then
    begin
    ppShape1.Brush.Color := clRed;
    ppShape1.Brush.Style := bsSolid;
    end
    else
    ppShape1.Brush.Style := bsClear;
    end;

    --
    Ed Dressel
    Team DM
  • edited March 2004
    Ed,

    Works fine, thanks.
    The red color was to dark when printed, any way of setting it to light
    red?

    /Ronny


  • edited March 2004
    Hi Ronny,

    It is possible to set the color of an object to a corresponding hexidecimal
    RGB value as well as the built in color types. For instance you could
    change the line setting the brush color to clRed to:

    ppShape1.Brush.Color := $004040FF;

    This should give you a somewhat lighter red. See TColor type in the Delphi
    help for more information.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.