示例#1
0
        public void Render(InkOverlay i, Graphics g)
        {
            int width  = weight.ToString().Length *15;
            int height = 18;

            stroke.DrawingAttributes       = i.DefaultDrawingAttributes.Clone();
            stroke.DrawingAttributes.Color = color;
            i.Renderer.Draw(g, stroke);

            Rectangle rect   = StrokeManager.InkSpaceToPixelRect(i, g, stroke.GetBoundingBox());
            Point     center = new Point(rect.X + rect.Width / 2 - width / 2, rect.Y + rect.Height / 2 - height / 2);

            g.FillRectangle(new SolidBrush(Color.White), center.X, center.Y, width, height);
            g.DrawString(weight.ToString(), new Font("Courier New", 14, FontStyle.Bold), new SolidBrush(Color.Black), center);
        }
示例#2
0
        public void Render(InkOverlay i, Graphics g)
        {
            if (stroke.Deleted == true)
            {
                return;
            }
            Rectangle rect = StrokeManager.InkSpaceToPixelRect(i, g, stroke.GetBoundingBox());

            if (isRect)
            {
                g.FillRectangle(new SolidBrush(fillColor), rect);
            }
            else
            {
                g.FillEllipse(new SolidBrush(fillColor), rect);
            }

            i.Renderer.Draw(g, stroke);
            Point[] p = { new Point(centerPoint.X, centerPoint.Y) };
            i.Renderer.InkSpaceToPixel(g, ref p);
            p[0].X -= 15;
            p[0].Y -= 10;
            g.DrawString(text, new Font("Arial", 10), new SolidBrush(textColor), p[0]);
        }
示例#3
0
 //Renders each edge and node and also marks the home and destination nodes
 public void Render(InkOverlay i, Graphics g)
 {
     for (int j = 0; j < edges.Length(); j++)
     {
         edges[j].Render(i, g);
     }
     for (int j = 0; j < nodes.Length(); j++)
     {
         nodes[j].Render(i, g);
         if (nodes[j].Equals(home))
         {
             g.DrawString("*", new Font("Arial", 30), new SolidBrush(Color.Green), StrokeManager.InkSpaceToPixelRect(i, g, nodes[j].Stroke.GetBoundingBox()));
         }
         else if (nodes[j].Equals(destination))
         {
             g.DrawString("X", new Font("Arial", 14, FontStyle.Bold), new SolidBrush(Color.Red), StrokeManager.InkSpaceToPixelRect(i, g, nodes[j].Stroke.GetBoundingBox()));
         }
     }
 }