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


C# Console.CursorSize属性代码示例

本文整理汇总了C#中System.Console.CursorSize属性的典型用法代码示例。如果您正苦于以下问题:C# Console.CursorSize属性的具体用法?C# Console.CursorSize怎么用?C# Console.CursorSize使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Console的用法示例。


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

示例1: Main

// 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;
    }
}
开发者ID:.NET开发者,项目名称:System,代码行数:23,代码来源:Console.CursorSize

输出:

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...)

示例2: Main

//引入命名空间
using System;

public class Test{
   static void Main(string[] args){


      // Change the Console appearance and redisplay.
      Console.Title = "Resized Console";
      Console.ResetColor();
      Console.Clear();
      Console.SetWindowSize(100, 50);
      Console.BufferHeight = 500;
      Console.BufferWidth = 100;
      Console.CursorLeft = 20;
      Console.CursorSize = 50;
      Console.CursorTop = 20;
      Console.CursorVisible = false;
      Console.WriteLine("Main method complete. Press Enter.");
      Console.ReadLine();

  }
}
开发者ID:C#程序员,项目名称:System,代码行数:23,代码来源:Console.CursorSize


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