Console.CursorSize プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)

/** @property */ public static int get_CursorSize () /** @property */ public static void set_CursorSize (int value)
文字セルの高さに対する割合で表されたカーソルのサイズ。プロパティ値の範囲は、1 ~ 100 です。


カーソルの外観は、プロパティ値が 1 の場合はセルの下辺に水平線として表示され、100 の場合はセル領域を完全に占有する形で表示されます。
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition プラットフォームメモ : 設定操作時に、指定された値の概算値がオペレーティング システムにより生成されます。 設定操作の効果は、その操作を実行したアプリケーションの終了時まで持続します。アプリケーション終了後は、カーソルのサイズが元の値に戻されます。

CursorSize プロパティの使用例を次に示します。この例では、コンソール キーが押されるたびにカーソルのサイズを増やし、終了前に元のサイズに戻します。
' This example demonstrates the Console.CursorSize property. Imports System Imports Microsoft.VisualBasic Class Sample Public Shared Sub Main() Dim m0 As String = "This example increments the cursor size from " & _ "1% to 100%:" & vbCrLf Dim m1 As String = "Cursor size = {0}%. (Press any key to continue...)" Dim sizes As Integer() = {1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100} Dim saveCursorSize As Integer ' saveCursorSize = Console.CursorSize Console.WriteLine(m0) Dim size As Integer For Each size In sizes Console.CursorSize = size Console.WriteLine(m1, size) Console.ReadKey() Next size Console.CursorSize = saveCursorSize End Sub 'Main End Class 'Sample ' 'This example produces the following results: ' 'This example increments the cursor size from 1% to 100%: ' 'Cursor size = 1%. (Press any key to continue...) 'Cursor size = 10%. (Press any key to continue...) 'Cursor size = 20%. (Press any key to continue...) 'Cursor size = 30%. (Press any key to continue...) 'Cursor size = 40%. (Press any key to continue...) 'Cursor size = 50%. (Press any key to continue...) 'Cursor size = 60%. (Press any key to continue...) 'Cursor size = 70%. (Press any key to continue...) 'Cursor size = 80%. (Press any key to continue...) 'Cursor size = 90%. (Press any key to continue...) 'Cursor size = 100%. (Press any key to continue...) '
// This example demonstrates the Console.CursorSize property. 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; } } /* This example produces the following results: This example increments the cursor size from 1% to 100%: Cursor size = 1%. (Press any key to continue...) Cursor size = 10%. (Press any key to continue...) Cursor size = 20%. (Press any key to continue...) Cursor size = 30%. (Press any key to continue...) Cursor size = 40%. (Press any key to continue...) Cursor size = 50%. (Press any key to continue...) Cursor size = 60%. (Press any key to continue...) Cursor size = 70%. (Press any key to continue...) Cursor size = 80%. (Press any key to continue...) Cursor size = 90%. (Press any key to continue...) Cursor size = 100%. (Press any key to continue...) */
// This example demonstrates the Console.CursorSize property. using namespace System; int main() { String^ m0 = "This example increments the cursor size from 1% to 100%:\n"; String^ m1 = "Cursor size = {0}%. (Press any key to continue...)"; array<Int32>^sizes = {1,10,20,30,40,50,60,70,80,90,100}; int saveCursorSize; // saveCursorSize = Console::CursorSize; Console::WriteLine( m0 ); System::Collections::IEnumerator^ myEnum = sizes->GetEnumerator(); while ( myEnum->MoveNext() ) { int size = *safe_cast<Int32^>(myEnum->Current); Console::CursorSize = size; Console::WriteLine( m1, size ); Console::ReadKey(); } Console::CursorSize = saveCursorSize; } /* This example produces the following results: This example increments the cursor size from 1% to 100%: Cursor size = 1%. (Press any key to continue...) Cursor size = 10%. (Press any key to continue...) Cursor size = 20%. (Press any key to continue...) Cursor size = 30%. (Press any key to continue...) Cursor size = 40%. (Press any key to continue...) Cursor size = 50%. (Press any key to continue...) Cursor size = 60%. (Press any key to continue...) Cursor size = 70%. (Press any key to continue...) Cursor size = 80%. (Press any key to continue...) Cursor size = 90%. (Press any key to continue...) Cursor size = 100%. (Press any key to continue...) */
// This example demonstrates the Console.CursorSize property. import System.*; class Sample { public static void main(String[] args) { 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.get_CursorSize(); Console.WriteLine(m0); for (int iCtr = 0; iCtr < sizes.get_Length(); iCtr++) { int size = sizes[iCtr]; Console.set_CursorSize(size); Console.WriteLine(m1, System.Convert.ToString(size)); Console.ReadKey(); } Console.set_CursorSize(saveCursorSize); } //main } //Sample /* This example produces the following results: This example increments the cursor size from 1% to 100%: Cursor size = 1%. (Press any key to continue...) Cursor size = 10%. (Press any key to continue...) Cursor size = 20%. (Press any key to continue...) Cursor size = 30%. (Press any key to continue...) Cursor size = 40%. (Press any key to continue...) Cursor size = 50%. (Press any key to continue...) Cursor size = 60%. (Press any key to continue...) Cursor size = 70%. (Press any key to continue...) Cursor size = 80%. (Press any key to continue...) Cursor size = 90%. (Press any key to continue...) Cursor size = 100%. (Press any key to continue...) */


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からConsole.CursorSize プロパティを検索する場合は、下記のリンクをクリックしてください。

- Console.CursorSize プロパティのページへのリンク