Is there a way to get programmatic access to the columns of a ActiveReports detail section?

StackOverflow https://stackoverflow.com/questions/2899521

Pergunta

I have a report in Data Dynamics ActiveReports for .NET. In this report I am programmatically setting the ColumnCount property of the detail section to X. The detail section has one databound textbox.

The ColumnDirection property of the detail section is set to AcrossDown and the and then the data binding mechanism automatically fills across with data after setting the DataSource and DataMember.

Here is the code...

Public Sub RunReport
        Dim count As Integer = 0

        ' ...    get count

        Detail1.ColumnCount = count

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

End Sub

That code works fine and the data is automatically filled across the report.

Now I need to alter the report and circle or highlight one of the items that is auto-filled across columns in the report.

I cannot find any way to programmatically access the auto-generated columns so I can turn on a border or draw a circle or something. Any ideas how I would do that?

Seth

Foi útil?

Solução

You can turn on a border by setting the properties of the control in the Format event. For example, if you wanted to set the border of a textbox when its value is less than zero, you might use something like the following code:

 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;
      }
 }

Read here for more info on the border property.

Getting the position of a control on the resulting page is not as easy. You can calculate the position based on some things, but I would recommend using the control itself to highlight the data you want rather than drawing on the page. It will make your life easier :)

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top