Exemplo n.º 1
0
        public static void Draw(Graphics graphics, PinStyle style, int cx, int cy)
        {
            var bodyRect = new Rectangle(cx - style.BodyWidth / 2, cy - style.BodyHeight / 2, style.BodyWidth, style.BodyHeight);

            //graphics.FillRectangle(style.BodyBrush, bodyRect);
            //graphics.DrawRectangle(style.BodyPen, bodyRect);
            graphics.FillEllipse(style.BodyBrush, bodyRect);
            graphics.DrawEllipse(style.BodyPen, bodyRect);

            var arrowPoints = new[]
            {
                new Point(cx - style.ArrowWidth / 2, cy + style.BodyHeight / 2),
                new Point(cx, cy + style.BodyHeight / 2 + style.ArrowHeight),
                new Point(cx + style.ArrowWidth / 2, cy + style.BodyHeight / 2)
            };

            graphics.FillPolygon(style.ArrowBrush, arrowPoints);
            graphics.DrawLines(style.ArrowPen, arrowPoints);
        }
Exemplo n.º 2
0
 public static bool CheckCoord(PinStyle style, int cx, int cy, int mx, int my)
 {
     return(mx < cx + style.BodyWidth / 2 && mx > cx - style.BodyWidth / 2 &&
            my < cy + style.BodyHeight / 2 && my > cy - style.BodyHeight / 2);
 }