private void drawLine(int city1, int city2) { intPair p1 = problem.positions[city1]; intPair p2 = problem.positions[city2]; g.DrawLine(Pens.Blue, (float)(p1.x * xStretch) + nodeSize/2, (float)(p1.y * yStretch) + nodeSize/2, (float)(p2.x * xStretch) + nodeSize / 2, (float)(p2.y * yStretch) + nodeSize / 2); }
private void drawNode(int city) { intPair p = problem.positions[city]; if (showNumbers) { g.DrawRectangle(Pens.Black, (float)(p.x * xStretch), (float)(p.y * yStretch), 2, 2); g.DrawString(city.ToString(), new Font("Arial", 15), Brushes.Blue, new PointF( (float)(p.x * xStretch) - nodeSize, (float)(p.y * yStretch) - nodeSize)); } else g.DrawRectangle(Pens.Black, (float)(p.x * xStretch), (float)(p.y * yStretch), nodeSize, nodeSize); }
private void fillNode(int city, Color c) { intPair p = problem.positions[city]; g.FillRectangle(new SolidBrush(c), (float)(p.x * xStretch), (float)(p.y * yStretch), nodeSize, nodeSize); g.DrawRectangle(Pens.Black, (float)(p.x * xStretch), (float)(p.y * yStretch), nodeSize, nodeSize); }