private void RecurseBuildToggleList(Rdl.Render.Element elmt, decimal top, decimal left) { if (elmt is TextElement) { TextElement te = elmt as TextElement; TextStyle ts = te.Style as TextStyle; int width = (int)elmt.Width; if (te.IsToggle) { ToggleElementStruct tes = new ToggleElementStruct(); tes.elmt = te; tes.rect = new Rectangle((int)left, (int)top, Properties.Resources.minus.Width, Properties.Resources.minus.Height); _displayedToggleList.Add(tes); } } if (elmt is Rdl.Render.Container) { foreach (Element child in ((Rdl.Render.Container)elmt).Children) { RecurseBuildToggleList(child, top + elmt.Top, left + elmt.Left); } } }
private void RecursePaintPanel(Graphics g, decimal xMult, decimal yMult, bool print, Rdl.Render.Element elmt, Point destOffset, decimal top, decimal left) { decimal mult = 1; int t = (int)((top + elmt.Top) * yMult) + destOffset.Y; int l = (int)((left + elmt.Left) * xMult) + destOffset.X; int w = (int)(elmt.Width * xMult); int h = (int)(elmt.Height * yMult); Rectangle clipRect = new Rectangle(l, t, w, h); if (elmt is Rdl.Render.TextElement || elmt is Rdl.Render.ImageElement || elmt is Rdl.Render.Container || elmt is Rdl.Render.ChartElement) { if (elmt.Style != null && elmt.Style.BackgroundColor != null) { g.FillRectangle(new SolidBrush(Rdl.Engine.Style.W32Color(elmt.Style.BackgroundColor)), clipRect); } if (elmt.Style != null && elmt.Style.BorderWidth != null) { Rdl.Render.Drawing.DrawBorder(g, new System.Drawing.Rectangle(l, t, w, h), elmt.Style.BorderWidth, elmt.Style.BorderStyle, elmt.Style.BorderColor, xMult, yMult); } } if (elmt.Style != null) { l += (int)(elmt.Style.PaddingLeft.points * xMult); t += (int)(elmt.Style.PaddingTop.points * yMult); w -= (int)((elmt.Style.PaddingLeft.points + elmt.Style.PaddingRight.points) * xMult); h -= (int)((elmt.Style.PaddingTop.points + elmt.Style.PaddingBottom.points) * yMult); } if (elmt is TextElement) { TextElement te = elmt as TextElement; TextStyle ts = te.Style as TextStyle; int width = (int)(elmt.Width * mult); if (te.IsToggle && !print) { if (te.ToggleState == TextElement.ToggleStateEnum.open) { g.DrawImage(Properties.Resources.minus, new Point(l, t)); } else { g.DrawImage(Properties.Resources.plus, new Point(l, t)); } l += Properties.Resources.minus.Width; width -= Properties.Resources.minus.Width; } StringFormat sf = new StringFormat(); Rdl.Engine.Style.TextAlignEnum align = ts.TextAlign; if (align == Rdl.Engine.Style.TextAlignEnum.General) { decimal d; if (decimal.TryParse(te.Text, out d)) { align = Rdl.Engine.Style.TextAlignEnum.Right; } else { align = Rdl.Engine.Style.TextAlignEnum.Left; } } switch (align) { case Rdl.Engine.Style.TextAlignEnum.General: case Rdl.Engine.Style.TextAlignEnum.Left: sf.Alignment = StringAlignment.Near; break; case Rdl.Engine.Style.TextAlignEnum.Center: sf.Alignment = StringAlignment.Center; break; case Rdl.Engine.Style.TextAlignEnum.Right: sf.Alignment = StringAlignment.Far; break; } g.DrawString(te.Text, _fonts[te.StyleIndex], new SolidBrush(Rdl.Engine.Style.W32Color(te.Style.Color)), new Rectangle(l, t, w, h), sf ); } if (elmt._imageIndex >= 0) { g.DrawImage(_report.ImageList[elmt._imageIndex].GetSizedImage(w, h), new Rectangle(l, t, w, h)); } if (elmt is ChartElement) { ChartElement cc = elmt as ChartElement; g.DrawImage(cc.RenderChart(w, h, xMult, yMult), new Rectangle(l, t, w, h)); } if (elmt is Rdl.Render.Container) { foreach (Element child in ((Rdl.Render.Container)elmt).Children) { RecursePaintPanel(g, xMult, yMult, print, child, destOffset, top + elmt.Top, left + elmt.Left); } } }