public static void ShowCursor()
        {
            CONSOLE_CURSOR_INFO cursorInfo = new CONSOLE_CURSOR_INFO {
                bVisible = false, dwSize = 25
            };

            HandleError(!WinApi.SetConsoleCursorInfo(bufferHandle, ref cursorInfo));
        }
 /// <summary>
 /// Делает курсор консоли невидимым и устанавливает значение
 /// CursorIsVisible в false.
 /// </summary>
 internal void HideCursor()
 {
     if (!usingLinux)
     {
         CONSOLE_CURSOR_INFO consoleCursorInfo = new CONSOLE_CURSOR_INFO {
             Size    = 5,
             Visible = false
         };
         Win32.SetConsoleCursorInfo(stdOutputHandle, ref consoleCursorInfo);
     }
     else
     {
         NCurses.curs_set(CursorVisibility.Invisible);
     }
     CursorIsVisible = false;
 }
Exemple #3
0
        public void SetCursorInfo(ConsoleOutputHandle consoleOutputHandle, bool visible, int size, Point position)
        {
            if (!NativeMethods.SetConsoleCursorPosition(consoleOutputHandle, new COORD(position)))
            {
                throw Exceptions.Win32();
            }
            CONSOLE_CURSOR_INFO info = new CONSOLE_CURSOR_INFO
            {
                Size    = size,
                Visible = visible
            };

            if (!NativeMethods.SetConsoleCursorInfo(consoleOutputHandle, ref info))
            {
                throw Exceptions.Win32();
            }
        }
Exemple #4
0
        public void Init()
        {
            var(rows, cols) = GetConsoleWindowSize();
            var requestedCols = _options.WindowOptions.Cols > 0 ? _options.WindowOptions.Cols : cols;
            var requestedRows = _options.WindowOptions.Rows > 0 ? _options.WindowOptions.Rows : rows;
            var rect          = new SMALL_RECT()
            {
                Left   = 0,
                Top    = 0,
                Bottom = (short)requestedRows,
                Right  = (short)requestedCols
            };

            if (_options.WindowOptions.Cols > 0 || _options.WindowOptions.Rows > 0)
            {
                ConsoleNative.SetConsoleWindowInfo(_hstdout, true, ref rect);
            }
            ConsoleNative.SetConsoleScreenBufferSize(_hstdout, new COORD((short)(rect.Right + 1), (short)(rect.Bottom + 1)));

            CONSOLE_CURSOR_INFO cursorInfo;

            ConsoleNative.GetConsoleCursorInfo(_hstdout, out cursorInfo);
            _initialCursorInfo = cursorInfo;
        }
Exemple #5
0
 internal static extern bool SetConsoleCursorInfo(IntPtr hConsoleOutput, ref CONSOLE_CURSOR_INFO cci);
 public static extern bool GetConsoleCursorInfo(
     IntPtr hConsoleOutput,
     out CONSOLE_CURSOR_INFO lpConsoleCursorInfo
     );
Exemple #7
0
 static extern bool SetConsoleCursorInfo(
     IntPtr hConsoleOutput,
     [In] ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo
     );
Exemple #8
0
 public static extern bool SetConsoleCursorInfo(
     SafeFileHandle hConsoleOutput,
     [In] ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo
     );
Exemple #9
0
 internal static extern bool SetConsoleCursorInfo(NakedWin32Handle consoleOutput, ref CONSOLE_CURSOR_INFO consoleCursorInfo);
Exemple #10
0
 internal static extern bool SetConsoleCursorInfo(ConsoleOutputHandle consoleOutputHandle, ref CONSOLE_CURSOR_INFO cursorInfo);
Exemple #11
0
 internal static extern bool SetConsoleCursorInfo(IntPtr hConsoleOutput, 
     ref CONSOLE_CURSOR_INFO cci);
Exemple #12
0
        public void SetCursorVisibility(bool isVisible)
        {
            var info = new CONSOLE_CURSOR_INFO(isVisible, _initialCursorInfo.Size);

            ConsoleNative.SetConsoleCursorInfo(_hstdout, ref info);
        }
        private static extern int SetConsoleCursorInfo(int hConsoleOutput, 
			ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
Exemple #14
0
 /// <summary>
 ///  Sets the size and visibility of the cursor for the specified console screen buffer.
 /// </summary>
 /// <param name="hConsoleOutput">A handle to the console screen buffer. The handle must have the <see cref="BUFFER_ACCESS_MODE.GENERIC_READ"/> access right.</param>
 /// <param name="lpConsoleCursorInfo">A pointer to a <see cref="CONSOLE_CURSOR_INFO"/> structure that provides the new specifications for the console screen buffer's cursor.</param>
 /// <returns>If the function succeeds, returns TRUE, otherwise, retun FALSE.</returns>
 [DllImport("kernel32.dll", SetLastError = true)] public static extern bool SetConsoleCursorInfo([In] IntPtr hConsoleOutput, [In] ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
Exemple #15
0
 private static extern int SetConsoleCursorInfo(int hConsoleOutput, ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
Exemple #16
0
 internal static partial bool GetConsoleCursorInfo(IntPtr hConsoleOutput, out CONSOLE_CURSOR_INFO cci);
Exemple #17
0
 public static extern bool SetConsoleCursorInfo(IntPtr hConsoleOutput, ref CONSOLE_CURSOR_INFO info);
Exemple #18
0
        /// <summary>
        /// Wraps Win32 SetConsoleCursorInfo
        /// </summary>
        /// <param name="consoleHandle">
        /// 
        /// handle for the console where cursor info is set
        /// 
        /// </param>
        /// <param name="cursorInfo">
        /// 
        /// cursor info to set the cursor
        /// 
        /// </param>
        /// <exception cref="HostException">
        /// If Win32's SetConsoleCursorInfo fails
        /// </exception>

        internal static void SetConsoleCursorInfo(ConsoleHandle consoleHandle, CONSOLE_CURSOR_INFO cursorInfo)
        {
            Dbg.Assert(!consoleHandle.IsInvalid, "ConsoleHandle is not valid");
            Dbg.Assert(!consoleHandle.IsClosed, "ConsoleHandle is closed");

            bool result = NativeMethods.SetConsoleCursorInfo(consoleHandle.DangerousGetHandle(), ref cursorInfo);

            if (result == false)
            {
                int err = Marshal.GetLastWin32Error();

                HostException e = CreateHostException(err, "SetConsoleCursorInfo",
                    ErrorCategory.ResourceUnavailable, ConsoleControlStrings.SetConsoleCursorInfoExceptionTemplate);
                throw e;
            }
        }
Exemple #19
0
 public static extern bool GetConsoleCursorInfo(IntPtr hConsoleOutput, out CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
 internal static extern bool GetConsoleCursorInfo
 (
     IntPtr consoleOutput,
     out CONSOLE_CURSOR_INFO consoleCursorInfo);