/// <summary> /// Draws the graph. /// </summary> /// <param name="graphics">The graphics object we want to draw to.</param> /// <param name="currentNode">The node the mouse is currently hovering over.</param> /// <param name="selectedNode">The node which is currently selected.</param> /// <param name="graphMousePos">The mouse's position in the graph.</param> internal void DrawGraph(Graphics graphics, NodeViewData currentNode, NodeViewData selectedNode, PointF graphMousePos) { // setup drawing graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; graphics.Transform = new System.Drawing.Drawing2D.Matrix(_scale, 0.0f, 0.0f, _scale, _offset.X, _offset.Y); // update display bounding boxes _rootNodeLayout.UpdateDisplay(_offset.X, _offset.Y, _scale); // draw comment backgrounds if (!_skipLabels) { _rootNodeLayout.DrawCommentBackground(graphics, _renderDepth, _padding); } // draw the edges if (_edgePen != null && _renderDepth > 0) { _rootNodeLayout.DrawEdges(graphics, _edgePen, _edgePenReadOnly, _renderDepth - 1); } // draw the nodes _rootNodeLayout.Draw(graphics, currentNode, selectedNode, _skipLabels, graphMousePos, _renderDepth); // draw comment text if (!_skipLabels) { _rootNodeLayout.DrawCommentText(graphics, _renderDepth); } // draw last mouse pos //e.Graphics.DrawRectangle(Pens.Red, graphMousePos.X -1.0f, graphMousePos.Y -1.0f, 2.0f, 2.0f); }
/// <summary> /// Draws the graph. /// </summary> /// <param name="dc">The graphics object we want to draw to.</param> /// <param name="currentNode">The node the mouse is currently hovering over.</param> /// <param name="selectedNode">The node which is currently selected.</param> /// <param name="graphMousePos">The mouse's position in the graph.</param> internal void DrawGraph(DrawingContext dc, NodeViewData currentNode, NodeViewData selectedNode, Point graphMousePos) { // setup drawing dc.PushTransform(new MatrixTransform(_scale, 0.0, 0.0, _scale, _offset.X, _offset.Y)); // update display bounding boxes _rootNodeLayout.UpdateDisplay(_offset.X, _offset.Y, _scale); // draw comment backgrounds if (!_skipLabels) { _rootNodeLayout.DrawCommentBackground(dc, _renderDepth, _padding); } // draw the edges if (_edgePen != null && _renderDepth > 0) { _rootNodeLayout.DrawEdges(dc, _edgePen, _edgePenReadOnly, _renderDepth - 1); } // draw the nodes _rootNodeLayout.Draw(dc, currentNode, selectedNode, _skipLabels, graphMousePos, _renderDepth); // draw comment text if (!_skipLabels) { _rootNodeLayout.DrawCommentText(dc, _renderDepth); } // draw last mouse pos //e.Graphics.DrawRectangle(Pens.Red, graphMousePos.X -1.0f, graphMousePos.Y -1.0f, 2.0f, 2.0f); dc.Pop(); }