語言

ConsoleKeyInfo(Char, ConsoleKey, Boolean, Boolean, Boolean) 建構函式

定義

使用指定的字元、主控台鍵和修飾鍵初始化結構的新實例 ConsoleKeyInfo 。

public:
 ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control);
public ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control);
new ConsoleKeyInfo : char * ConsoleKey * bool * bool * bool -> ConsoleKeyInfo
Public Sub New (keyChar As Char, key As ConsoleKey, shift As Boolean, alt As Boolean, control As Boolean)

參數

keyChar
Char

對應參數的 Unicode 字元 key 。

key
ConsoleKey

對應參數的主控台金鑰 keyChar 。

shift
Boolean

true用來表示按下 SHIFT 鍵;否則,。 false

alt
Boolean

true用來表示按下了 ALT 鍵;否則,。 false

control
Boolean

true用來表示按下了 CTRL 鍵;否則,。 false

例外狀況

參數的 key 數值小於0或大於255。

備註

此類型並非設計給使用者自行建立。 取而代之的是,呼叫該方法後,該資料會被回傳給使用者 Console.ReadKey 。

該 ConsoleKeyInfo 類型未指定按下左、右 SHIFT、ALT 或 CTRL 修飾鍵。

適用於