コード例 #1
0
ファイル: DrawingHelper.cs プロジェクト: remygrandin/CLIForms
        internal static ConsoleCharBuffer DrawBlockFull(ConsoleCharBuffer buffer, DisplayObject owner, bool focusable, int x, int y, int w, int h, ConsoleColor?backgroundColor, ConsoleColor foregroundColor, BorderStyle style, ShadowStyle shadow)
        {
            // Border
            buffer.DrawString(owner, GetTopLeftCornerBorder(style) +
                              new string(GetHorizontalBorder(style)[0], w - 2) +
                              GetTopRightCornerBorder(style), focusable, x, y, backgroundColor, foregroundColor);

            for (int i = y + 1; i < y + h - 1; i++)
            {
                buffer.DrawString(owner, GetVerticalBorder(style) + new string(' ', w - 2) + GetVerticalBorder(style), focusable, x, i, backgroundColor, foregroundColor);
            }

            buffer.DrawString(owner, GetBottomLeftCornerBorder(style) +
                              new string(GetHorizontalBorder(style)[0], w - 2) +
                              GetBottomRightCornerBorder(style), focusable, x, y + h - 1, backgroundColor, foregroundColor);

            if (shadow != ShadowStyle.None)
            {
                for (int i = y + 1; i < y + h; i++)
                {
                    buffer.DrawString(owner, GetShadow(shadow), focusable, x + w, i, null, foregroundColor);
                }

                buffer.DrawString(owner, new string(GetShadow(shadow)[0], w), focusable, x + 1, y + h, null, foregroundColor);
            }

            return(buffer);
        }
コード例 #2
0
ファイル: DrawingHelper.cs プロジェクト: remygrandin/CLIForms
        internal static ConsoleCharBuffer DrawShadow(ConsoleCharBuffer buffer, DisplayObject owner, bool focusable, int x, int y, int w, int h, ConsoleColor foregroundColor, ShadowStyle shadow)
        {
            if (shadow != ShadowStyle.None)
            {
                for (int i = y + 1; i < y + h; i++)
                {
                    buffer.DrawString(owner, GetShadow(shadow), focusable, x + w, i, null, foregroundColor);
                }

                buffer.DrawString(owner, new string(GetShadow(shadow)[0], w), focusable, x + 1, y + h, null, foregroundColor);
            }

            return(buffer);
        }
コード例 #3
0
ファイル: DrawingHelper.cs プロジェクト: remygrandin/CLIForms
        internal static ConsoleCharBuffer DrawBlockOutline(ConsoleCharBuffer buffer, DisplayObject owner, bool focusable, int x, int y, int w, int h, ConsoleColor backgroundColor, ConsoleColor foregroundColor, BorderStyle style, ShadowStyle shadow)
        {
            // Border
            buffer.DrawString(owner, GetTopLeftCornerBorder(style) +
                              new string(GetHorizontalBorder(style)[0], w - 2) +
                              GetTopRightCornerBorder(style), focusable, x, y, backgroundColor, foregroundColor);

            for (int i = y + 1; i < y + h - 1; i++)
            {
                buffer.DrawString(owner, GetVerticalBorder(style), focusable, x, i, backgroundColor, foregroundColor);

                buffer.DrawString(owner, GetVerticalBorder(style), focusable, x + w, i, backgroundColor, foregroundColor);
            }

            buffer.DrawString(owner, GetBottomLeftCornerBorder(style) +
                              new string(GetHorizontalBorder(style)[0], w - 2) +
                              GetBottomRightCornerBorder(style), focusable, x, y + h - 1, backgroundColor, foregroundColor);

            buffer = DrawShadow(buffer, owner, focusable, x, y, w, h, foregroundColor, shadow);

            return(buffer);
        }