当前位置: 首页>>代码示例>>C#>>正文


C# CONSOLE_SCREEN_BUFFER_INFO类代码示例

本文整理汇总了C#中CONSOLE_SCREEN_BUFFER_INFO的典型用法代码示例。如果您正苦于以下问题:C# CONSOLE_SCREEN_BUFFER_INFO类的具体用法?C# CONSOLE_SCREEN_BUFFER_INFO怎么用?C# CONSOLE_SCREEN_BUFFER_INFO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CONSOLE_SCREEN_BUFFER_INFO类属于命名空间,在下文中一共展示了CONSOLE_SCREEN_BUFFER_INFO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ColorConsole

 // Constructor.
 public ColorConsole()
 {
     ConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
     ConsoleOutputLocation = new COORD();
     hConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
     GetConsoleScreenBufferInfo(hConsoleHandle, ref ConsoleInfo);
     OriginalColors = ConsoleInfo.wAttributes;
 }
开发者ID:JackFong,项目名称:NetworkMonitor.Net,代码行数:9,代码来源:ColorConsole.cs

示例2: ColorConsole

		public ColorConsole()
		{
			hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
			if(IsHandleValid())
			{
				CONSOLE_SCREEN_BUFFER_INFO csbiInfo = new CONSOLE_SCREEN_BUFFER_INFO();
				GetConsoleScreenBufferInfo(hStdout, ref csbiInfo);
				attributes = csbiInfo.wAttributes;
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-msnet-netz-compressor-madebits,代码行数:10,代码来源:ColorConsole.cs

示例3: Clear

	public static void Clear()
	{
		int hWrittenChars = 0;
		CONSOLE_SCREEN_BUFFER_INFO strConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
		COORD Home;
		Home.x = Home.y = 0;
		GetConsoleScreenBufferInfo(hConsoleHandle, ref strConsoleInfo);
		FillConsoleOutputCharacter(hConsoleHandle, EMPTY, strConsoleInfo.dwSize.x * strConsoleInfo.dwSize.y, Home, ref hWrittenChars);
		SetConsoleCursorPosition(hConsoleHandle, Home);
	}
开发者ID:rjgodia30,项目名称:bcit-courses,代码行数:10,代码来源:ConsoleUtils.cs

示例4: ConsoleEx

        static ConsoleEx()
        {
            // Grab input and output buffer handles
            hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
            hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
            if (hConsoleOutput == INVALID_HANDLE_VALUE || hConsoleInput == INVALID_HANDLE_VALUE)
                throw new ApplicationException("Unable to obtain buffer handle during initialization.");

            // Get information about the console window characteristics.
            ConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
            //ConsoleOutputLocation = new COORD();
            GetConsoleScreenBufferInfo(hConsoleOutput, ref ConsoleInfo);
            OriginalConsolePen = ConsoleInfo.wAttributes;

            // Disable wrapping at the end of a line (ENABLE_WRAP_AT_EOL_INPUT); this enables rectangles
            // to be drawn that fill the screen without the window scrolling.
            SetConsoleMode(hConsoleOutput,
                (int) OutputModeFlags.ENABLE_PROCESSED_OUTPUT);
        }
开发者ID:rangerofthewest,项目名称:Dungeon_Crawl,代码行数:19,代码来源:_ConsoleEx.cs

示例5: GetConsoleWindowWidth

        /// <summary>
        /// Returns the number of columns in the current console window
        /// </summary>
        /// <returns>Returns the number of columns in the current console window</returns>
        public static int GetConsoleWindowWidth()
        {
            int screenWidth;
            CONSOLE_SCREEN_BUFFER_INFO csbi = new CONSOLE_SCREEN_BUFFER_INFO();

            int rc;
            rc = GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), ref csbi);
            screenWidth = csbi.dwSize.x;
            return screenWidth;
        }
开发者ID:chris-han,项目名称:MTC-Beijing-Azure-IoT-Workshop,代码行数:14,代码来源:CommandLineArguments.cs

示例6: GetConsoleScreenBufferInfo

 public static extern int GetConsoleScreenBufferInfo(int hConsoleOutput,
     ref CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
开发者ID:MagnusVortex,项目名称:OCTGN,代码行数:2,代码来源:Interop.cs

示例7: GetConsoleScreenBufferInfo

		private static extern bool GetConsoleScreenBufferInfo(
			IntPtr consoleHandle,
			out CONSOLE_SCREEN_BUFFER_INFO bufferInfo);
开发者ID:kevinswarner,项目名称:Hover_OLD,代码行数:3,代码来源:ColoredConsoleAppender.cs

示例8: RemoveIntensity

 /// <summary>
 /// Decreases forground color intensity
 /// </summary>
 internal static void RemoveIntensity()
 {
     CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
     GetConsoleScreenBufferInfo(hConsoleOut, ref ConsoleInfo);
     SetConsoleTextAttribute(hConsoleOut, (ushort)(ConsoleInfo.wAttributes & (~FR_INTENSITY)));
 }
开发者ID:silupher,项目名称:ChassisManager,代码行数:9,代码来源:NativeMethods.cs

示例9: GetConsoleScreenBufferInfo

 private static extern bool GetConsoleScreenBufferInfo(IntPtr hConsoleOutput,
                  ref CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
开发者ID:silupher,项目名称:ChassisManager,代码行数:2,代码来源:NativeMethods.cs

示例10: GetConsoleWindowWidth

        /// <summary>
        /// Returns the number of columns in the current console window
        /// </summary>
        /// <returns>Returns the number of columns in the current console window</returns>
        public static int GetConsoleWindowWidth()
        {
            int screenWidth;
            CONSOLE_SCREEN_BUFFER_INFO csbi = new CONSOLE_SCREEN_BUFFER_INFO();

            // If the function succeeds, the return value is nonzero.
            int rc = GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), ref csbi);
            if (rc == 0){
                throw new ApplicationException ("Unable to obtain console width");
            }

            screenWidth = csbi.dwSize.x;
            return screenWidth;
        }
开发者ID:ArsenShnurkov,项目名称:slntools,代码行数:18,代码来源:CommandLineParser.cs

示例11: GetConsoleScreenBufferInfo

			internal static bool GetConsoleScreenBufferInfo(IntPtr consoleHandle, out ConsoleControl.CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo)
			{
				ConsoleControl.CONSOLE_SCREEN_BUFFER_INFO c = new CONSOLE_SCREEN_BUFFER_INFO();
				c.BufferSize.X = (short)Console.BufferWidth;
				c.BufferSize.Y = (short)Console.BufferHeight;
				c.CursorPosition.X = (short)Console.CursorLeft;
				c.CursorPosition.Y = (short)Console.CursorTop;
				c.MaxWindowSize.X = (short)Console.LargestWindowWidth;
				c.MaxWindowSize.Y = (short)Console.LargestWindowHeight;
				consoleScreenBufferInfo = c;
				return true;
			}
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:ConsoleControl.cs

示例12: Move

        /// <summary>
        /// Moves the console cursor to the specified location on the screen.
        /// </summary>
        /// <param name="x">X co-ordinate for desired location (typically 0 to 79)</param>
        /// <param name="y">Y co-ordinate for desired location (typically 0 to 24)</param>
        public static void Move(int x, int y)
        {
            // Check that parameters specified are sane
            CONSOLE_SCREEN_BUFFER_INFO strConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
            GetConsoleScreenBufferInfo(hConsoleOutput, ref strConsoleInfo);

            if (x >= strConsoleInfo.dwSize.x ||  x < 0)
                throw new ArgumentOutOfRangeException("x", x,
                    "The co-ordinates specified must be within the dimensions of the window.");

            if (y >= strConsoleInfo.dwSize.y || y < 0)
                throw new ArgumentOutOfRangeException("y", y,
                    "The co-ordinates specified must be within the dimensions of the window.");

            COORD cursorLocation;
            cursorLocation.x = (short)x;
            cursorLocation.y = (short)y;

            SetConsoleCursorPosition(hConsoleOutput, cursorLocation);
        }
开发者ID:rangerofthewest,项目名称:Dungeon_Crawl,代码行数:25,代码来源:_ConsoleEx.cs

示例13: Clear

        /// <summary>
        /// Clears screen.
        /// </summary>
        public static void Clear()
        {
            int hWrittenChars = 0;
            CONSOLE_SCREEN_BUFFER_INFO strConsoleInfo = new CONSOLE_SCREEN_BUFFER_INFO();
            COORD Home;
            Home.x = Home.y = 0;

            if (GetConsoleScreenBufferInfo(hConsoleOutput, ref strConsoleInfo) == 0)
            {
                // If the device does not support GetConsoleScreenBufferInfo, then try just
                // writing ^L (ASCII control code for Form Feed) to the screen. This may
                // work for some scenarios such as using telnet to access a remote console.
                Console.Write('\x0c');	// ^L
                return;
            }

            FillConsoleOutputCharacter(hConsoleOutput, EMPTY,
                strConsoleInfo.dwSize.x * strConsoleInfo.dwSize.y, Home, ref hWrittenChars);
            FillConsoleOutputAttribute(hConsoleOutput, CurrentConsolePen,
                strConsoleInfo.dwSize.x * strConsoleInfo.dwSize.y, Home, ref hWrittenChars);

            SetConsoleCursorPosition(hConsoleOutput, Home);
        }
开发者ID:rangerofthewest,项目名称:Dungeon_Crawl,代码行数:26,代码来源:_ConsoleEx.cs

示例14: GetConsoleScreenBufferInfo

 internal static extern bool GetConsoleScreenBufferInfo(IntPtr hConsoleOutput,
     out CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:2,代码来源:Win32Native.cs

示例15: get_console_buffer

        private CONSOLE_SCREEN_BUFFER_INFO get_console_buffer()
        {
            var defaultConsoleBuffer = new CONSOLE_SCREEN_BUFFER_INFO
            {
                dwSize = new COORD(),
                dwCursorPosition = new COORD(),
                dwMaximumWindowSize = new COORD(),
                srWindow = new SMALL_RECT(),
                wAttributes = 0,
            };

            if (!is_windows()) return defaultConsoleBuffer;

            CONSOLE_SCREEN_BUFFER_INFO csbi;
            if (GetConsoleScreenBufferInfo(GetStdHandle(StdHandle.StdOut), out csbi))
            {
                // if the console buffer exists
                return csbi;
            }

            return defaultConsoleBuffer;
        }
开发者ID:RichiCoder1,项目名称:choco,代码行数:22,代码来源:Console.cs


注:本文中的CONSOLE_SCREEN_BUFFER_INFO类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。