Пример #1
0
        public static void DrawArrow(DiagramPainter dp, Graphics g, int x1, int y1, int x2, int y2, ReferenceStyle.ArrowStyle style)
        {
            Point2D  a   = new Point2D(x1, y1);
            Point2D  b   = new Point2D(x2, y2);
            float    len = (a - b).Size;
            Point2D  e   = b + (a - b) * (style.DistanceFromEnd / len);                                // vrchol sipky
            Point2D  f   = b + (a - b) * ((style.DistanceFromEnd + style.Length - style.Delta) / len); // konec sipky
            Vector2D n   = (b - a).NormalVector.Normalized;
            Point2D  p   = b + (a - b) * ((style.DistanceFromEnd + style.Length) / len);               // pata sipky
            Point2D  s   = p + n * (style.Width / 2);                                                  //jedno kridlo sipky
            Point2D  t   = p - n * (style.Width / 2);                                                  //druhe kridlo sipky

            PointF[] triangle = new PointF[3];
            g.FillPolygon(dp.GetSolidBrush(style.Color), new PointF[] { e, f, s });
            g.FillPolygon(dp.GetSolidBrush(style.Color), new PointF[] { e, f, t });
        }
Пример #2
0
 public static void DrawArrow(DiagramPainter dp, Graphics g, Point a, Point b, ReferenceStyle.ArrowStyle style)
 {
     DrawArrow(dp, g, a.X, a.Y, b.X, b.Y, style);
 }