void drawchildxlright(Graphics g, xl xl, Point offset, int width, int height) { int drawcount = 0; foreach (gtNode node in xl.nodes) { if (node.NeedDraw) drawcount++; } gtNode node0 = xl.nodes[xl.nodes.Count - 1]; if (!node0.NeedDraw) drawcount += 1; float step = width / drawcount; if (drawcount == 1) step /= 2; step = Math.Min(mMinDJ, step); step = Math.Max(1, step); while (step < 30) step *= 2; width = (int)(step * drawcount); step *= offset.X; int left = xl.parentNode.Location.X; int bottom = xl.parentNode.Location.Y; int right = left + offset.X * width; int offx = xl.getOffx() * offset.X; right += offx; g.DrawLine(Pens.BlueViolet, left, bottom, right, bottom); //if (!xl.nodes[0].NeedDraw) { // xl.nodes[0].Location = new Point(left,(int)step); // xl.nodes[0].render(g); //} if (!node0.NeedDraw) { node0.Location = new Point(right, bottom); node0.render(g); } int j = -1; int i = 0; //Point offset = new Point(0, 50 * j); int nlines = 0; foreach (gtNode node in xl.nodes) { if (!node.NeedDraw) continue; i++; if (node.lines.Count > 0) { nlines++; } node.Location = new Point(offx+ left + (int)(i * step),bottom); node.render(g); foreach (xl xl0 in node.lines) { if (strList.Contains(xl0.xlValue.LineCode)) continue; xl0.index = nlines; strList.Add(xl0.xlValue.LineCode); drawchildxltop(g, xl0, offset, (int)step * 3/2, height); } offset.Y *= -1; } }
void drawchildxltop(Graphics g,xl xl, Point offset, int width,int height) { int drawcount = 0; foreach (gtNode node in xl.nodes) { if (node.NeedDraw) drawcount++; } gtNode node0 = xl.nodes[xl.nodes.Count - 1]; if (!node0.NeedDraw) drawcount += 1; float step = height / drawcount; if (drawcount == 1) step /= 2; step = Math.Min(mMinDJ, step); height =(int) (step * drawcount); step *= offset.Y; int left = xl.parentNode.Location.X; int bottom = xl.parentNode.Location.Y; int top = bottom + offset.Y* height; int offx = xl.getOffx()*offset.Y; top += offx; g.DrawLine(Pens.BlueViolet, left, bottom, left, top); //if (!xl.nodes[0].NeedDraw) { // xl.nodes[0].Location = new Point(left,(int)step); // xl.nodes[0].render(g); //} if (!node0.NeedDraw) { node0.Location = new Point(left, top); node0.render(g); } int j = -1; int i = 0; int nlines = 0; //Point offset = new Point(0, 50 * j); foreach (gtNode node in xl.nodes) { if (!node.NeedDraw) continue; i++; if (node.lines.Count > 0) { nlines++; } node.Location = new Point(left, offx+bottom + (int)(i * step)); node.render(g); foreach (xl xl0 in node.lines) { if (strList.Contains(xl0.xlValue.LineCode)) continue; xl0.index = nlines; xl0.isV = true; strList.Add(xl0.xlValue.LineCode); drawchildxlright(g, xl0, offset, width,(int)Math.Abs(step)*3/2); offset.X *= -1; } } }