要通过控制台检查CapsLock是打开还是关闭,代码如下-
输出结果
这将产生以下输出-
The CAPS LOCK is on or not? False要通过控制台检查NumLock是打开还是关闭,代码如下-
using System; public class Demo{ public static void Main(string[] args){ Console.WriteLine("The Num LOCK is on or not? "+ Console.NumberLock); } }输出结果
这将产生以下输出-
The Num LOCK is on or not? True