469,275 Members | 1,694 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Dynamically change background color in Crystal Reports.Net

I have a Crystal Reports.Net report being generated from my C#
application. I would like to change the background color of the
details section (not the text mind you) of the report on certain
conditions. For example if the value of the 'Meeting Number' is
greater than 100 the background color of the details section will be
light yellow, otherwise it will be white. There will be multiple
records in this reports so one (or a few) detail section might be
yellow while all others on the page are white; or vice versa. I could
either change the color of the background section to yellow or possibly
create a yellow rectangle around the section and turn it
visible/invisible at runtime depending on the value of my field.

Does anyone have any ideas on how I can accomplish this?

TIA,

ngpost1

Sep 6 '06 #1
1 15704

ng*****@hotmail.com wrote:
I have a Crystal Reports.Net report being generated from my C#
application. I would like to change the background color of the
details section (not the text mind you) of the report on certain
conditions. For example if the value of the 'Meeting Number' is
greater than 100 the background color of the details section will be
light yellow, otherwise it will be white. There will be multiple
records in this reports so one (or a few) detail section might be
yellow while all others on the page are white; or vice versa. I could
either change the color of the background section to yellow or possibly
create a yellow rectangle around the section and turn it
visible/invisible at runtime depending on the value of my field.

Does anyone have any ideas on how I can accomplish this?

TIA,

ngpost1
I found a way to do this - kinda.

I added a new field to my report's DataSet called Highlight. I added
that field to my report and set the background color, border and text
color all to be light yellow. I set the SupressIfZero property to
True. At runtime, I loop through the DataSet and if Meeting Number is
greater than 100 I set the value of the Highlight field to X otherwise
I set it to and empty string.

When the report is rendered if the Highlight field is not empty (per
the SupressIfZero setting) it will be displayed; otherwise it is
suppressed. Because the border color, background color and text is all
the same color it just looks like a yellow box around everything.

ngpost1

Sep 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by David Dvali | last post: by
1 post views Thread by =?Utf-8?B?U3RldmUgQmFya2Vy?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.