MaskedTextProvider 构造函数
定义
初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class.
重载
| MaskedTextProvider(String) |
使用指定的掩码初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask. |
| MaskedTextProvider(String, Boolean) |
使用指定的掩码和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask and ASCII restriction value. |
| MaskedTextProvider(String, CultureInfo) |
使用指定的掩码和区域性初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask and culture. |
| MaskedTextProvider(String, Char, Boolean) |
使用指定的掩码、密码字符和用法提示值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, password character, and prompt usage value. |
| MaskedTextProvider(String, CultureInfo, Boolean) |
使用指定的掩码、区域性和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, and ASCII restriction value. |
| MaskedTextProvider(String, CultureInfo, Char, Boolean) |
使用指定的掩码、区域性、密码字符和用法提示值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, password character, and prompt usage value. |
| MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) |
使用指定的掩码、区域性、用法提示值、提示字符、密码字符和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, prompt usage value, prompt character, password character, and ASCII restriction value. |
MaskedTextProvider(String)
使用指定的掩码初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask.
public:
MaskedTextProvider(System::String ^ mask);
public MaskedTextProvider (string mask);
new System.ComponentModel.MaskedTextProvider : string -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String)
参数
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , null, true, '_', '\0', false)
另请参阅
适用于
MaskedTextProvider(String, Boolean)
使用指定的掩码和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask and ASCII restriction value.
public:
MaskedTextProvider(System::String ^ mask, bool restrictToAscii);
public MaskedTextProvider (string mask, bool restrictToAscii);
new System.ComponentModel.MaskedTextProvider : string * bool -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, restrictToAscii As Boolean)
参数
- restrictToAscii
- Boolean
如果将输入限制为与 ASCII 兼容的字符,则为 true;如果允许使用整个 Unicode 字符集,则为 false。true to restrict input to ASCII-compatible characters; otherwise false to allow the entire Unicode set.
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , null, true, '_', '\0', restrictToASCII)
另请参阅
适用于
MaskedTextProvider(String, CultureInfo)
使用指定的掩码和区域性初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask and culture.
public:
MaskedTextProvider(System::String ^ mask, System::Globalization::CultureInfo ^ culture);
public MaskedTextProvider (string mask, System.Globalization.CultureInfo culture);
new System.ComponentModel.MaskedTextProvider : string * System.Globalization.CultureInfo -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, culture As CultureInfo)
参数
- culture
- CultureInfo
CultureInfo,用于设置区分区域的分隔符。A CultureInfo that is used to set region-sensitive separator characters.
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , culture, true, '_', '\0', false)
另请参阅
适用于
MaskedTextProvider(String, Char, Boolean)
使用指定的掩码、密码字符和用法提示值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, password character, and prompt usage value.
public:
MaskedTextProvider(System::String ^ mask, char passwordChar, bool allowPromptAsInput);
public MaskedTextProvider (string mask, char passwordChar, bool allowPromptAsInput);
new System.ComponentModel.MaskedTextProvider : string * char * bool -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, passwordChar As Char, allowPromptAsInput As Boolean)
参数
- passwordChar
- Char
将为输入到密码字符串中的字符显示的 Char。A Char that will be displayed for characters entered into a password string.
- allowPromptAsInput
- Boolean
如果允许将提示字符作为输入,则为 true;否则为 false。true to allow the prompt character as input; otherwise false.
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , null, allowPromptAsInput, '_', passwordChar, false)
另请参阅
适用于
MaskedTextProvider(String, CultureInfo, Boolean)
使用指定的掩码、区域性和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, and ASCII restriction value.
public:
MaskedTextProvider(System::String ^ mask, System::Globalization::CultureInfo ^ culture, bool restrictToAscii);
public MaskedTextProvider (string mask, System.Globalization.CultureInfo culture, bool restrictToAscii);
new System.ComponentModel.MaskedTextProvider : string * System.Globalization.CultureInfo * bool -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, culture As CultureInfo, restrictToAscii As Boolean)
参数
- culture
- CultureInfo
CultureInfo,用于设置区分区域的分隔符。A CultureInfo that is used to set region-sensitive separator characters.
- restrictToAscii
- Boolean
如果将输入限制为与 ASCII 兼容的字符,则为 true;如果允许使用整个 Unicode 字符集,则为 false。true to restrict input to ASCII-compatible characters; otherwise false to allow the entire Unicode set.
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , culture, true, '_', '\0', restrictToAscii)
另请参阅
适用于
MaskedTextProvider(String, CultureInfo, Char, Boolean)
使用指定的掩码、区域性、密码字符和用法提示值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, password character, and prompt usage value.
public:
MaskedTextProvider(System::String ^ mask, System::Globalization::CultureInfo ^ culture, char passwordChar, bool allowPromptAsInput);
public MaskedTextProvider (string mask, System.Globalization.CultureInfo culture, char passwordChar, bool allowPromptAsInput);
new System.ComponentModel.MaskedTextProvider : string * System.Globalization.CultureInfo * char * bool -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, culture As CultureInfo, passwordChar As Char, allowPromptAsInput As Boolean)
参数
- culture
- CultureInfo
CultureInfo,用于设置区分区域的分隔符。A CultureInfo that is used to set region-sensitive separator characters.
- passwordChar
- Char
将为输入到密码字符串中的字符显示的 Char。A Char that will be displayed for characters entered into a password string.
- allowPromptAsInput
- Boolean
如果允许将提示字符作为输入,则为 true;否则为 false。true to allow the prompt character as input; otherwise false.
注解
此构造函数的使用完全等效于以下对 MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) 构造函数的调用:Use of this constructor is exactly equivalent to the following call to the MaskedTextProvider.MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean) constructor:
MaskedTextProvider(mask , culture, allowPromptAsInput, '_', passwordChar, false)
另请参阅
适用于
MaskedTextProvider(String, CultureInfo, Boolean, Char, Char, Boolean)
使用指定的掩码、区域性、用法提示值、提示字符、密码字符和 ASCII 限制值初始化 MaskedTextProvider 类的新实例。Initializes a new instance of the MaskedTextProvider class using the specified mask, culture, prompt usage value, prompt character, password character, and ASCII restriction value.
public:
MaskedTextProvider(System::String ^ mask, System::Globalization::CultureInfo ^ culture, bool allowPromptAsInput, char promptChar, char passwordChar, bool restrictToAscii);
public MaskedTextProvider (string mask, System.Globalization.CultureInfo culture, bool allowPromptAsInput, char promptChar, char passwordChar, bool restrictToAscii);
new System.ComponentModel.MaskedTextProvider : string * System.Globalization.CultureInfo * bool * char * char * bool -> System.ComponentModel.MaskedTextProvider
Public Sub New (mask As String, culture As CultureInfo, allowPromptAsInput As Boolean, promptChar As Char, passwordChar As Char, restrictToAscii As Boolean)
参数
- culture
- CultureInfo
CultureInfo,用于设置区分区域的分隔符。A CultureInfo that is used to set region-sensitive separator characters.
- allowPromptAsInput
- Boolean
一个 Boolean 值,指定是否应允许提示字符作为有效的输入字符。A Boolean value that specifies whether the prompt character should be allowed as a valid input character.
- passwordChar
- Char
将为输入到密码字符串中的字符显示的 Char。A Char that will be displayed for characters entered into a password string.
- restrictToAscii
- Boolean
如果将输入限制为与 ASCII 兼容的字符,则为 true;如果允许使用整个 Unicode 字符集,则为 false。true to restrict input to ASCII-compatible characters; otherwise false to allow the entire Unicode set.
例外
掩码参数为 null 或 Empty。The mask parameter is null or Empty.
- 或 --or- 掩码包含一个或多个不可打印字符。The mask contains one or more non-printable characters.
注解
此构造函数表示最常见的重载形式。This constructor represents the most general overloaded form. mask参数必须符合类定义的掩码语言 MaskedTextProvider ,该类在类的属性中进行了详细说明 MaskedTextBox.Mask MaskedTextBox 。The mask parameter must conform to the masking language defined by the MaskedTextProvider class, which is detailed in the MaskedTextBox.Mask property of the MaskedTextBox class.
由于不能查询非特定区域性的信息,因此 MaskedTextProvider 构造函数将使用 GetCultures 方法来搜索第一个非特定区域性,以确定正确的分隔符。Because neutral cultures cannot be queried for culture-specific information, the MaskedTextProvider constructor will use the GetCultures method to search for the first non-neutral culture to use to determine the proper separator characters.