static void getImageOfRenderingElement(RenderElement e, ref Graphics g, int xOffset, int yOffset, int left, int right, int top, int bottom, Pen p = null, int xShrink = 0, int yShrink = 0) { if (p == null) p = dashedPen != null ? dashedPen : Pens.DarkMagenta; if (e.Height > 0 && e.Width > 0 && g != null) { g.DrawRectangle(p , (e.X + xOffset) * PIN_2_PIXEL_FACTOR + xShrink , (e.Y + yOffset) * PIN_2_PIXEL_FACTOR + yShrink , e.Width * PIN_2_PIXEL_FACTOR - (2 * xShrink) , e.Height * PIN_2_PIXEL_FACTOR - (2 * yShrink) ); if (e.HasSubParts()) { foreach (var item in e.GetSubParts()) { if (item.IsCompletelyInArea(left, right, top, bottom)) { getImageOfRenderingElement(item, ref g, xOffset, yOffset, left, right, top, bottom, Pens.DarkTurquoise, xShrink + 1, yShrink + 1); } } } else { if (e.GetValue() != null) { String value = String.IsNullOrEmpty(e.DisplayName) ? e.GetValue().ToString() : e.DisplayName; if (!String.IsNullOrWhiteSpace(value)) { int x = (e.X + xOffset) * PIN_2_PIXEL_FACTOR + (2 * xShrink); int y = (e.Y + yOffset) * PIN_2_PIXEL_FACTOR + (2 * yShrink); int width = e.Width * PIN_2_PIXEL_FACTOR - (4 * xShrink); int height = e.Height * PIN_2_PIXEL_FACTOR - (4 * yShrink); g.FillRectangle(backgroundBrush, new Rectangle(x, y, width, height)); g.DrawString(value, textFont, textBrush, new Rectangle(x, y, width, height)); } } } } }
static void getImageOfRenderingElement(RenderElement e, ref Graphics g, int xOffset, int yOffset, int left, int right, int top, int bottom, Pen p = null, int xShrink = 0, int yShrink = 0) { if (p == null) p = dashedPen != null ? dashedPen : Pens.DarkMagenta; if (e.Height > 0 && e.Width > 0 && g != null) { g.DrawRectangle(p , (e.X + xOffset) * PIN_2_PIXEL_FACTOR + xShrink , (e.Y + yOffset) * PIN_2_PIXEL_FACTOR + yShrink , e.Width * PIN_2_PIXEL_FACTOR - (2 * xShrink) , e.Height * PIN_2_PIXEL_FACTOR - (2 * yShrink) ); if (e.HasSubParts()) { foreach (var item in e.GetSubParts()) { if (item.IsCompletelyInArea(left, right, top, bottom)) { getImageOfRenderingElement(item, ref g, xOffset, yOffset, left, right, top, bottom, Pens.DarkTurquoise, xShrink + 1, yShrink + 1); } } } else { if (e.GetValue() != null) { String value = e.GetValue().ToString(); if (!String.IsNullOrWhiteSpace(value)) { int x = (e.X + xOffset) * PIN_2_PIXEL_FACTOR + (2 * xShrink); int y = (e.Y + yOffset) * PIN_2_PIXEL_FACTOR + (2 * yShrink); int width = e.Width * PIN_2_PIXEL_FACTOR - (4 * xShrink); int height = e.Height * PIN_2_PIXEL_FACTOR - (4 * yShrink); g.FillRectangle(backgroundBrush, new Rectangle(x, y, width, height)); g.DrawString(value, textFont, textBrush, new Rectangle(x, y, width, height)); } } } } }