Changing Console Window's size throws ArgumentOutOfRangeException

前端 未结 4 1076
有刺的猬
有刺的猬 2021-01-07 19:39

I am trying to set the size of the Console Window in a c# console application. I get an ArgumentOutOfRangeException with this message:

Th

4条回答
  •  时光取名叫无心
    2021-01-07 20:11

    you can set a windowHeight less than 62, if u try exceed this value error throw the system.

    class Pro
    {
        public static void fun()
        {
            Console.WindowHeight = 61;
            Console.WriteLine("Welcome to asp .net ");
        }
    
    
        static void Main(string[] args)
        {
            Pro.fun();
        }
    
        // Summary:
        //     Gets the largest possible number of console window rows, based on the current
        //     font and screen resolution.
        //
        // Returns:
        //     The height of the largest possible console window measured in rows.
        public static int LargestWindowHeight { get; }
    
        // Summary:
        //     Gets the largest possible number of console window columns, based on the
        //     current font and screen resolution.
        //
        // Returns:
        //     The width of the largest possible console window measured in columns.
        public static int LargestWindowWidth { get; }
    

    The above information catch Console[from metadata].

提交回复
热议问题