MaskedTextBox.ResetOnPrompt 屬性

定義

取得或設定值,判斷應如何處理符合提示字元的輸入字元。

public:
 property bool ResetOnPrompt { bool get(); void set(bool value); };
public bool ResetOnPrompt { get; set; }
member this.ResetOnPrompt : bool with get, set
Public Property ResetOnPrompt As Boolean

屬性值

true 表示輸入的提示字元會造成遮罩中目前的可編輯位置重設,而 false 則表示提示字元會當做一般輸入字元處理。 預設為 true

備註

MaskedTextBox可以處理兩個類別的字元 - 空格和提示字元 - 特別。 一般而言,每個輸入字元都會針對遮罩進行測試,並接受或拒絕。 假設 PromptChar 屬性設定為非 null ,則將 ResetOnPrompt 屬性設定為 true 將會導致提示字元的特殊處理。 當使用者在遮罩中輸入提示字元時,會導致清除目前的遮罩字元位置,並將目前位置進階到下一個可編輯的字元。

ResetOnPrompt 優先于 AllowPromptAsInput 屬性,如下表所示。

ResetOnPrompt 值 AllowPromptAsInput 值 產生的行為
true true 您可以輸入提示字元,並重設目前的遮罩位置。 此為預設值。
true false 您可以輸入提示字元,並重設目前的遮罩位置。
false true 提示字元會處理為標準輸入字元。
false false 提示字元無效,並引發 MaskInputRejected 事件。

適用於

另請參閱