private static RectangleWindow PositionAdjustRectangle(
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            RectangleWindow rect)
        {
            PositionControl positionAdjusted = ToolResultRender.GetPositionAdjusted(posSetting, posResult, (WindowShape)rect);

            return(new RectangleWindow(positionAdjusted.sPoint.nX, positionAdjusted.sPoint.nY, (ushort)rect.Size.Width, (ushort)rect.Size.Height, positionAdjusted.nAngle));
        }
        private static void DrawPositionAdjustedVector(
            Graphics graphics,
            Color color,
            WindowShape toolWindow,
            PositionControl description)
        {
            WindowShape     toolWindow1     = (WindowShape)null;
            RectangleWindow rectangleWindow = toolWindow as RectangleWindow;

            if (rectangleWindow != null)
            {
                toolWindow1 = (WindowShape) new RectangleWindow(description.sPoint.nX, description.sPoint.nY, (ushort)rectangleWindow.Size.Width, (ushort)rectangleWindow.Size.Height, (short)((int)description.nAngle + toolWindow.Angle));
            }
            CircleWindow circleWindow = toolWindow as CircleWindow;

            if (circleWindow != null)
            {
                toolWindow1 = (WindowShape) new CircleWindow(description.sPoint.nX, description.sPoint.nY, (ushort)circleWindow.Diameter);
            }
            ToolResultRender.DrawVector(graphics, color, toolWindow1);
        }
        private static void DrawVector(Graphics graphics, Color color, WindowShape toolWindow)
        {
            RectangleWindow rectangleWindow = toolWindow as RectangleWindow;

            using (Pen pen = new Pen(color, 2.5f))
            {
                if (rectangleWindow != null)
                {
                    ToolResultRender.DrawRectangle(graphics, pen, rectangleWindow.Center, rectangleWindow.Size, (float)rectangleWindow.Angle);
                }
                CircleWindow circleWindow = toolWindow as CircleWindow;
                if (circleWindow != null)
                {
                    ToolResultRender.DrawCircle(graphics, pen, circleWindow.Center, circleWindow.Diameter);
                }
            }
            if (toolWindow == null)
            {
                return;
            }
            ToolResultRender.DrawArrow(graphics, color, toolWindow);
        }
        private static void DrawPositionUnadjustedVector(
            Graphics graphics,
            Color color,
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            WindowShape toolWindow)
        {
            WindowShape     toolWindow1 = (WindowShape)null;
            RectangleWindow rect        = toolWindow as RectangleWindow;

            if (rect != null)
            {
                toolWindow1 = (WindowShape)ToolResultRender.PositionAdjustRectangle(posSetting, posResult, rect);
            }
            CircleWindow circle = toolWindow as CircleWindow;

            if (circle != null)
            {
                toolWindow1 = (WindowShape)ToolResultRender.PositionAdjustCircle(posSetting, posResult, circle);
            }
            ToolResultRender.DrawVector(graphics, color, toolWindow1);
        }