コード例 #1
0
            public void SetCursorShown(bool shown)
            {
                ConsoleCursorInfo cursorInfo = new ConsoleCursorInfo {
                    Size = 1, Visible = shown
                };

                Platform.SetConsoleCursorInfo(consoleHandle, ref cursorInfo);
            }
コード例 #2
0
ファイル: ConsoleTests.cs プロジェクト: JinJoyce/winapinet
        public void GetConsoleCursorInfo()
        {
            SafeConsoleHandle handle = CreateConsoleScreenBuffer(ConsoleAccess.GENERIC_READ);

            var cursorInfo = new ConsoleCursorInfo();
            bool result = WinConsole.GetConsoleCursorInfo(handle, cursorInfo);
            Trace.WriteLine(TestHelpers.ObjectToString(cursorInfo));

            Assert.That(result, Is.True);
        }
コード例 #3
0
ファイル: WinConsole.cs プロジェクト: JinJoyce/winapinet
        /// <summary>
        /// Retrieves information about the size and visibility of the cursor for the specified console screen buffer.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <c>GENERIC_READ</c> access right.
        /// </param>
        /// <returns>
        /// A pointer to a <see cref="ConsoleCursorInfo"/> structure that receives information about the console's
        /// cursor.
        /// </returns>
        public static ConsoleCursorInfo GetConsoleCursorInfo(SafeConsoleHandle hConsoleOutput)
        {
            var lpConsoleCursorInfo = new ConsoleCursorInfo();
            WinError.ThrowLastWin32ErrorIfFailed(
                GetConsoleCursorInfo(hConsoleOutput, lpConsoleCursorInfo));

            return lpConsoleCursorInfo;
        }
コード例 #4
0
        private void SetCursorInfo(bool visible, int size)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }

            ConsoleCursorInfo cci = new ConsoleCursorInfo(visible, size);
            if (!WinCon.SetConsoleCursorInfo(_handle, cci))
            {
                throw new ApplicationException("Error setting cursor information.");
            }
        }
コード例 #5
0
 private ConsoleCursorInfo GetCursorInfo()
 {
     if (disposed)
     {
         throw new ObjectDisposedException(this.ToString());
     }
     ConsoleCursorInfo cci = new ConsoleCursorInfo();
     if (!WinCon.GetConsoleCursorInfo(_handle, cci))
     {
         throw new ApplicationException("Error getting cursor information.");
     }
     return cci;
 }
コード例 #6
0
 public static extern bool SetConsoleCursorInfo(IntPtr consoleHandle, ref ConsoleCursorInfo cursorInfo);