示例#1
0
        public void Draw(Graphics graphics)
        {
            var boundary = ShapeBoundary.GetFor(this);

            graphics.DrawEllipse(Pen, boundary);
            graphics.FillEllipse(Brush, boundary);
        }
示例#2
0
        public void Draw(Graphics graphics)
        {
            var boundary = ShapeBoundary.GetFor(this);

            graphics.DrawRectangle(Pen, boundary);
            graphics.FillRectangle(Brush, boundary);
        }
示例#3
0
        public void MakeSymetric()
        {
            var bonduary = ShapeBoundary.GetFor(this);
            var min      = Math.Min(bonduary.Width, bonduary.Height);

            if (End.X > Start.X && End.Y > Start.Y)
            {
                End = new Point(Start.X + min, Start.Y + min);
            }
            else if (End.X < Start.X && End.Y > Start.Y)
            {
                End = new Point(Start.X - min, Start.Y + min);
            }
            else if (End.X > Start.X && End.Y < Start.Y)
            {
                End = new Point(Start.X + min, Start.Y - min);
            }
            else
            {
                End = new Point(Start.X - min, Start.Y - min);
            }
        }
示例#4
0
        public void MakeSymetric()
        {
            var bonduary = ShapeBoundary.GetFor(this);
            var width    = bonduary.Width;
            var height   = bonduary.Height;
            var min      = Math.Min(bonduary.Width, bonduary.Height);
            var max      = Math.Max(bonduary.Width, bonduary.Height);

            if (End.X > Start.X && End.Y > Start.Y)
            {
                if (width / 2 > height)
                {
                    End = new Point(Start.X + max, Start.Y);
                }
                else if (height / 2 > width)
                {
                    End = new Point(Start.X, Start.Y + max);
                }
                else
                {
                    End = new Point(Start.X + min, Start.Y + min);
                }
            }
            else if (End.X < Start.X && End.Y > Start.Y)
            {
                if (width / 2 > height)
                {
                    End = new Point(Start.X - max, Start.Y);
                }
                else if (height / 2 > width)
                {
                    End = new Point(Start.X, Start.Y + max);
                }
                else
                {
                    End = new Point(Start.X - min, Start.Y + min);
                }
            }
            else if (End.X > Start.X && End.Y < Start.Y)
            {
                if (width / 2 > height)
                {
                    End = new Point(Start.X + max, Start.Y);
                }
                else if (height / 2 > width)
                {
                    End = new Point(Start.X, Start.Y - max);
                }
                else
                {
                    End = new Point(Start.X + min, Start.Y - min);
                }
            }
            else if (End.X < Start.X)
            {
                if (width / 2 > height)
                {
                    End = new Point(Start.X - max, Start.Y);
                }
                else if (height / 2 > width)
                {
                    End = new Point(Start.X, Start.Y - max);
                }
                else
                {
                    End = new Point(Start.X - min, Start.Y - min);
                }
            }
        }