private void PagePainting(object sender, PagePaintEventArgs e) { double sum = 0, v; int count = 0; // Perform actions for all bricks on the current page. foreach (TextBrick brick in e.Page) { if (brick != null) { double d; if (!(brick.TextValue is string) || !double.TryParse((string)brick.TextValue, out d)) { continue; } v = Convert.ToDouble(brick.TextValue); // Check the brick identification and perform calculations accordingly. switch (brick.ID) { case "Count": count++; break; case "Sum": sum += v; break; } } } // Assign the resulting values to the bricks, // which represent totals in the page footer. ((TextBrick)sbriks[0]).Text = String.Format("{0:0.##}", count); ((TextBrick)sbriks[1]).Text = String.Format("{0:0.##}", sum); }
protected override void OnPagePaint(PagePaintEventArgs e) { base.OnPagePaint(e); PaintInfo(e.Graphics, e.Page.ClientRectangle, Color.White); }