FigRhombus.cs 1.08 KB
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace flowchart
{
    class FigRhombus : FigBase
    {
        // 생성자도 상속해서 사용.
        public FigRhombus(Point location, Size size) : base(location, size)
        {

        }

        public override void Draw(Graphics g)
        {
            using (Pen pen = new Pen(Color.Red, 1))
            {
                //Rectangle rect = new Rectangle(this.Location, this.Size);
                int x1, x2, x3, y1, y2, y3;
                x1 = Location.X;
                x2 = Location.X + Size.Width / 2;
                x3 = Location.X + Size.Width;
                y1 = Location.Y;
                y2 = Location.Y + Size.Height / 2;
                y3 = Location.Y + Size.Height;

                g.DrawLine(pen, x1, y2, x2, y1);
                g.DrawLine(pen, x2, y1, x3, y2);
                g.DrawLine(pen, x3, y2, x2, y3);
                g.DrawLine(pen, x2, y3, x1, y2);
            }

            base.Draw(g);
        }
    }
}