改变行或文本框的背景色 [英] Alternating the background color of rows or text boxes

查看:78
本文介绍了改变行或文本框的背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Crystal没有数据网格,因此我使用VS2010 SQLServer在SAP的Crystal报表中有来自数据库的数据,这些数据显示在文本框中。

I have data coming from data base in crystal report by SAP with VS2010 SQLServer, displayed in text boxes since Crystal doesn't have data grids.

怎么办我会替换这些文本框的背景颜色吗?

How can there I alternate the background colors of those text boxes?

推荐答案

创建自定义公式;称其为'Colorize':

Create a custom formula; call it 'Colorize':

//Color every other row as light tan (alter RGB to suit tastes)
Function (Numbervar row, Optional Numbervar Color := RGB(239,235,220))

If Remainder(row,2)=0 Then
    Color
Else
    crNoColor

将以下内容添加到详细信息部分的背景色条件格式公式中:

Add the following to the Detail section's Background Color conditional-formatting formula:

Colorize(RecordNumber)

//or over-ride color
Colorize(RecordNumber, crSilver)

您还可以通过传递GroupNumber关键字将其与组标题部分一起使用:

You can also use it with group header section by passing the GroupNumber keyword:

Colorize(GroupNumber)

如果您在做什么花哨的w /分组,您可能想使用一个总计公式:

If you are doing anything fancy w/ grouping, you may want to use a running-total formula:

//{@G1}
WhilePrintingRecords;
Numbervar i;
i:=1+1;

将此公式添加到组标题部分,然后取消显示。

Add this formula to group-header section, then suppress it.

将石斑鱼头的条件公式更改为:

Change the grouper-header's conditional formula to:

WhilePrintingRecords;
Numbervar i;
Colorize(i);

这篇关于改变行或文本框的背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆