MaskedTextBox.SelectedText 屬性

定義

取得或設定 MaskedTextBox 控制項中的目前選取項目。

public:
 virtual property System::String ^ SelectedText { System::String ^ get(); void set(System::String ^ value); };
public override string SelectedText { get; set; }
member this.SelectedText : string with get, set
Public Overrides Property SelectedText As String

屬性值

String 形式的目前所選文字。 如果目前未選取任何文字,則這個屬性會解析為空字串。

備註

使用此屬性擷取的選取專案會根據控制項的格式屬性來格式化,例如 MaskFormatProviderTextMaskFormatCutCopyMaskFormat 。 使用這個屬性設定的選取專案的行為就像貼上作業:每個字元都會與遮罩相符,而且 MaskInputRejected 會針對無效字元引發 事件。 如果 CutCopyMaskFormattrue ,則設定 時 SelectedText 允許常值和提示字元,除非它們違反遮罩,否則會以無訊息方式移除。

適用於

另請參閱