void drawStartArrow(Graphics g, MethodData d1, MethodData d2, float y, String title) { Pen p = new Pen(getThreadColor(d1.methodEvent.ThreadID), 2 * zoomScale); if (d1.classData == d2.classData) { float arrowWidth = 5 * zoomScale; g.DrawLine(p, d1.getColumnRightX(), y + 8 * zoomScale, d1.getColumnRightX() + 20 * zoomScale, y + 8 * zoomScale); g.DrawLine(p, d1.getColumnRightX() + 20 * zoomScale, y + 8 * zoomScale, d1.getColumnRightX() + 20 * zoomScale, y - 8 * zoomScale); g.DrawLine(p, d1.getColumnRightX() + 20 * zoomScale, y - 8 * zoomScale, d2.getColumnRightX(), y - 8 * zoomScale); g.DrawLine(p, d1.getColumnRightX() + arrowWidth, y + 3 * zoomScale, d1.getColumnRightX(), y + 8 * zoomScale); g.DrawLine(p, d1.getColumnRightX() + arrowWidth, y + 13 * zoomScale, d1.getColumnRightX(), y + 8 * zoomScale); if (zoomScale >= 0.6) g.DrawString(title, new Font("Tahoma", 7 * zoomScale), Brushes.Black, d2.getColumnRightX() + 5 * zoomScale, y - 23 * zoomScale); return; } else { y += 5 * zoomScale; float x2 = d1.getColumnLeftX(); float x1 = d2.getColumnRightX(); g.DrawLine(p, x1, y, x2, y); float arrowWidth = 5 * zoomScale; if (x1 < x2) { g.DrawLine(p, x2 - arrowWidth, y - arrowWidth, x2, y); g.DrawLine(p, x2 - arrowWidth, y + arrowWidth, x2, y); if (zoomScale >= 0.6) g.DrawString(title, new Font("Tahoma", 7 * zoomScale), Brushes.Black, x1 + arrowWidth, y - 15 * zoomScale); } else { g.DrawLine(p, x2 + arrowWidth, y - arrowWidth, x2, y); g.DrawLine(p, x2 + arrowWidth, y + arrowWidth, x2, y); if (zoomScale >= 0.6) g.DrawString(title, new Font("Tahoma", 7 * zoomScale), Brushes.Black, x1 - arrowWidth, y - 15 * zoomScale); } } }
void drawReturnArrow(Graphics g, MethodData d1, MethodData d2, float y) { if (d1.classData == d2.classData) { return; } y -= 5 * zoomScale; Pen p = new Pen(getThreadColor(d1.methodEvent.ThreadID), 2 * zoomScale); float x1 = d1.getColumnLeftX(); float x2 = d2.getColumnRightX(); float[] dashValues = { 4, 1 }; p.DashPattern = dashValues; g.DrawLine(p, x1, y, x2, y); float arrowWidth = 5 * zoomScale; if (x1 < x2) { g.DrawLine(p, x2 - arrowWidth, y - arrowWidth, x2, y); g.DrawLine(p, x2 - arrowWidth, y + arrowWidth, x2, y); } else { g.DrawLine(p, x2 + arrowWidth, y - arrowWidth, x2, y); g.DrawLine(p, x2 + arrowWidth, y + arrowWidth, x2, y); } }
void drawMethodLeave(Graphics g, MethodData d, float startY) { Pen pen = new Pen(getThreadColor(d.methodEvent.ThreadID)); float leftX = d.getColumnLeftX(); float rightX = d.getColumnRightX(); g.DrawLine(pen, leftX, startY, rightX, startY); if (d.callerMethodData != null) { drawReturnArrow(g, d, d.callerMethodData, startY); } }
void drawMethodEnter(Graphics g, MethodData d, float startY) { Pen pen = new Pen(getThreadColor(d.methodEvent.ThreadID)); float leftX = d.getColumnLeftX(); float rightX = d.getColumnRightX(); g.DrawLine(pen, leftX, startY, rightX, startY); if (d.callerMethodData != null) { drawStartArrow(g, d, d.callerMethodData, startY, d.methodEvent.MethodInfo.MethodName + "()"); } }
void drawMethodData(Graphics g, MethodData d, float startY, float endY) { Pen pen = new Pen(getThreadColor(d.methodEvent.ThreadID)); float leftX = d.getColumnLeftX(); float rightX = d.getColumnRightX(); //g.DrawRectangle(pen, leftX, startY, rightX - leftX, endY - startY); g.DrawLine(pen, leftX, startY, leftX, endY); g.DrawLine(pen, rightX, startY, rightX, endY); }
void drawException(Graphics g, MethodData d, float y) { Brush pen = new SolidBrush(getThreadColor(d.methodEvent.ThreadID)); float x = d.getColumnRightX() + 5; GraphicsState s = g.Save(); g.TranslateTransform(x, y); g.ScaleTransform(zoomScale, zoomScale); GraphicsPath gfxPath = new GraphicsPath(); gfxPath.AddLine( 7, 0, 15, 0); gfxPath.AddLine(15, 0, 8, 7); gfxPath.AddLine( 7, 8, 12, 8); gfxPath.AddLine(12, 8, 0, 16); gfxPath.AddLine( 0, 16, 4, 9); gfxPath.AddLine( 4, 9, 0, 9); gfxPath.CloseFigure(); g.FillPath(pen, gfxPath); gfxPath.Dispose(); g.Restore(s); }