【问题标题】:Is there a way to get programmatic access to the columns of a ActiveReports detail section?有没有办法以编程方式访问 ActiveReports 详细信息部分的列?
【发布时间】:2010-05-25 07:58:33
【问题描述】:

我在 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

该代码运行良好,数据会自动填充到整个报告中。

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

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

赛斯

【问题讨论】:

  • 如果我下面的答案不是您想要的,请在我的答案上添加评论,我很乐意为您提供所需的任何帮助。

标签: .net visual-studio activereports


【解决方案1】:

您可以通过在 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;
      }
 }

阅读here 了解有关边框属性的更多信息。

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

如果圆形对您来说很重要,您可以使用 ActiveReports 中的“形状”控件通过根据条件设置其位置和可见性来执行此操作。只需确保形状的 z 顺序位于文本框下方。使用形状的代码与我构建上述代码的方式类似,但您将设置形状控件的 Top/Left/Width/Height 和 Visible 属性,而不是设置边框属性。更多关于形状控制的信息是here

希望这会有所帮助。

 Scott Willeke
 GrapeCity

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-16
    • 2011-03-27
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 2019-09-01
    • 2011-03-28
    相关资源
    最近更新 更多