C# Console CursorSize

Description

Console CursorSize gets or sets the height of the cursor within a character cell.

Syntax

Console.CursorSize has the following syntax.


public static int CursorSize { get; set; }

Example

This example demonstrates the CursorSize property.


/*from   w w  w. j  a v a2s .  c o  m*/
using System;

class Sample 
{
    public static void Main() 
    {
        string m0 = "This example increments the cursor size from 1% to 100%:\n";
        string m1 = "Cursor size = {0}%. (Press any key to continue...)";
        int[] sizes = {1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
        int saveCursorSize;
    
        saveCursorSize = Console.CursorSize;
        Console.WriteLine(m0);
        foreach (int size in sizes)
        {
            Console.CursorSize = size;
            Console.WriteLine(m1, size);
            Console.ReadKey();
        }
        Console.CursorSize = saveCursorSize;
    }
}




















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version