コード例 #1
0
ファイル: CProgram.cs プロジェクト: default0/ConsoleLib
        public static void Main(String[] p_args)
        {
            ConsoleOutputField p_field = new ConsoleOutputField(2, 2, 25, 10, "Test");
            p_field.WriteLine("My\nTest\nTest\n\n\r\n\n\nConsole Test gets longer than you!\nHi\nBye\nCiao");

            Console.ReadLine();
        }
コード例 #2
0
        /// <summary>
        /// Constructs a new bordered console output field for the given position of the given size and with the given name. Field names must be unique.
        /// </summary>
        /// <param name="thickBorder">True if the border should use thick lines, false otherwise.</param>
        /// <param name="x">The x position of the new console field.</param>
        /// <param name="y">The y position of the new console field.</param>
        /// <param name="width">The width of the new console field.</param>
        /// <param name="height">The height of the new console field.</param>
        /// <param name="name">The name of the new console field.</param>
        public BorderedConsoleOutputField(Boolean thickBorder, Int32 x, Int32 y, Int32 width, Int32 height, String name)
            : base(x, y, 0, 0, name)
        {
            hasThickBorder = thickBorder;

            borderColor = ConsoleColor.Gray;
            borderBackColor = ConsoleColor.Black;

            textField = new ConsoleOutputField(x + 1, y + 1, width - 2, height - 2, name + "___BORDERED_INNER_FIELD");
            topBorder = new ConsoleOutputField(x, y, width, 1, name + "___BORDERED_TOP_BORDER");
            bottomBorder = new ConsoleOutputField(x, y + height - 1, width, 1, name + "___BORDERED_BOTTOM_BORDER");
            leftBorder = new ConsoleOutputField(x, y + 1, 1, height - 2, name + "___BORDERED_LEFT_BORDER");
            rightBorder = new ConsoleOutputField(x + width - 1, y + 1, 1, height - 2, name + "___BORDERED_RIGHT_BORDER");

            Width = width; // have to set Width and Height here, because we give 0/0 to the base to skip the collision check
            Height = height;
            refreshBorder();
            Title = "";
        }