0

我在 Data Dynamics ActiveReports for .NET 中有一份报告。在此报告中,我以编程方式将详细信息部分的 ColumnCount 属性设置为 X。详细信息部分有一个数据绑定文本框。

detail 部分的 ColumnDirection 属性设置为 AcrossDown,然后数据绑定机制在设置 DataSource 和 DataMember 后自动填充数据。

这是代码...

Public Sub RunReport
        Dim count As Integer = 0

        ' ...    get count

        Detail1.ColumnCount = count

        Me.DataSource = ds
        Me.DataMember = ds.Tables(0).TableName

End Sub

该代码可以正常工作,并且数据会自动填充到报告中。

现在我需要更改报告并圈出或突出显示报告中跨列自动填充的项目之一。

我找不到任何以编程方式访问自动生成的列的方法,因此我可以打开边框或画一个圆圈或其他东西。有什么想法我会怎么做?

赛斯

4

1 回答 1

2

您可以通过在 Format 事件中设置控件的属性来打开边框。例如,如果你想在文本框的值小于零时设置它的边框,你可以使用类似下面的代码:

 private void detail_Format(object sender, System.EventArgs eArgs)
 {
      if (this.TextBox1.Value < 0) {
           this.TextBox1.Border.BottomColor = System.Drawing.Color.Blue;
           this.TextBox1.Border.BottomStyle = BorderLineStyle.DashDot;
           this.TextBox1.Border.LeftColor = System.Drawing.Color.Blue;
           this.TextBox1.Border.LeftStyle = BorderLineStyle.DashDot;
           this.TextBox1.Border.RightColor = System.Drawing.Color.Blue;
           this.TextBox1.Border.RightStyle = BorderLineStyle.DashDot;
           this.TextBox1.Border.TopColor = System.Drawing.Color.Blue;
           this.TextBox1.Border.TopStyle = BorderLineStyle.DashDot;
      }
 }

阅读此处了解有关边界属性的更多信息。

在结果页面上获取控件的位置并不容易。你可以根据一些东西来计算位置,但我建议使用控件本身来突出显示你想要的数据,而不是在页面上绘制。它会让你的生活更轻松:)

If a circle shape is important for you, you could use the "Shape" control in ActiveReports to do this by setting it's position and visibility based on a condition. Just make sure the shape's z-order is under the textboxes. The code to use a shape would be similar to how I structured the code above, but you would set the Top/Left/Width/Height and the Visible property of the shape control instead of setting border properties. More information on the shape control is here.

Hope this helps.

 Scott Willeke
 GrapeCity
于 2010-05-24T23:58:33.970 回答