Example #1
0
        public CornerSide(int piecePosition, char color, CornerSideType type, Sq1ImageProp properties) : base(piecePosition, color, properties)
        {
            SetCoordFromPolar(properties.LongFaceDist, piecePosition + 2);
            SetCoordFromPolar(properties.LongSideDist, piecePosition + 2);
            var shortOffest = type == CornerSideType.First ? 0 : 4;

            SetCoordFromPolar(properties.ShortSideDist, piecePosition + shortOffest);
            SetCoordFromPolar(properties.ShortFaceDist, piecePosition + shortOffest);
        }
        private void DrawCornerLine(Graphics graphics, Pen pen, CornerSideType side, int imageWidth)
        {
            Point point1;
            Point point2;

            if (side == CornerSideType.Left)
            {
                point1 = new Point(_cornerWidth / 2, 0);
                point2 = new Point(0, _cornerHeight / 2);
            }
            else
            {
                point1 = new Point(imageWidth - (_cornerWidth / 2) - 1, 0);
                point2 = new Point(imageWidth, _cornerHeight / 2 + 1);
            }
            graphics.DrawLine(pen, point1, point2);
        }
        private void DrawCornerArc(Graphics graphics, Pen pen, CornerSideType side)
        {
            int x;
            int y;
            int penWidth = Convert.ToInt32(pen.Width);

            float sweepAngle;

            if (side == CornerSideType.Left)
            {
                x = penWidth / 2;
                y = penWidth / 2;
                sweepAngle = -90F;
            }
            else
            {
                //x = ((_tabWidth - 1) - (_cornerWidth * 2) - 1) - (penWidth / 2);

                x = ((_tabWidth - 1) - (_cornerWidth * 2) - 1) + (_cornerWidth / 2) - (penWidth / 2);

                y = penWidth / 2;
                sweepAngle = 90F;
            }

            graphics.DrawArc(pen, x, y, _cornerWidth, _cornerHeight, 270, sweepAngle);
        }