MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Types > MaskedTextBoxCell |
The masked text box cell offers features equivalent to the .NET Framework's MaskedTextBox control (System.Windows.Forms.MaskedTextBox). You can use the masked text box cell to provide the user with formatted input.
In addition to the Base Cell features, the following features can also be used in the masked text box cell.
For more details on each feature, refer to the MaskedTextBoxCell class.
The masked text box cell uses the Object type value and this type can be checked with the MaskedTextBoxCell.ValueType property. The value used for input and display is the one cast into the String type based on the MaskedTextBoxCell.Mask property format. This type can be checked with the MaskedTextBoxCell.FormattedValueType property. To modify the behavior when values are read in a cell, you can override the MaskedTextBoxCell.OnCellFormatting method. Override the MaskedTextBoxCell.OnCellParsing method to modify behavior when the value is written back from the cell.
The masked text box cell value can be edited in the MaskedTextBoxEditingControl control. This control inherits the IEditingControl interface and System.Windows.Forms.MaskedTextBox class. The cell edit control type can be checked with the MaskedTextBoxCell.EditType property.
The masked text box cell supports the following CellStyle class members. You can set the cell style using the MaskedTextBoxCell.Style property.
CellStyle Members | Non-Editable State | Editable State |
---|---|---|
BackColor | Enabled | Enabled |
Border | Enabled | Enabled |
DataSourceNullValue | Enabled | Enabled |
DisabledBackColor | Enabled | - |
DisabledForeColor | Enabled | - |
Font | Enabled | Enabled |
ForeColor | Enabled | Enabled |
Format | Enabled | Enabled |
FormatProvider | Enabled | Enabled |
GradientColors | Enabled | - |
GradientDirection | Enabled | - |
GradientStyle | Enabled | - |
Image | Enabled | - |
ImageAlign | Enabled | - |
ImeMode | Enabled | Enabled |
ImeSentenceMode | Enabled | Enabled |
InputScope | Enabled | Enabled |
LineAdjustment | Enabled only for GDI+ Compatible Mode | - |
Margin | Enabled | Enabled |
Multiline | Enabled | - |
NullValue | Enabled | Enabled |
Padding | Enabled | Enabled |
PatternColor | Enabled | - |
PatternStyle | Enabled | - |
SelectionBackColor | Enabled | - |
SelectionForeColor | Enabled | - |
Tag | Enabled | Enabled |
TextAdjustment | Enabled only for GDI+ Compatible Mode | - |
TextAlign | Enabled | Enabled only for horizontal |
TextAngle | Enabled only for GDI+ Compatible Mode | - |
TextEffect | Enabled | - |
TextImageRelation | Enabled | - |
TextIndent | Enabled | - |
TextVertical | Enabled only for GDI+ Compatible Mode | - |
UseCompatibleTextRendering | Enabled | - |
WordWrap | Enabled | - |
To set GDI+ Compatible Mode as Enabled, set the MaskedTextBoxCell.Style.UseCompatibleTextRendering property to True.
The table below lists the keys processed when the masked text box cell is in an edit state and lists keys that are processed by the GcMultiRow control.
Modifier | Key | MaskedTextBoxCell | GcMultiRow |
---|---|---|---|
None | Keys.PageUp | - | Enabled |
Keys.PageDown | - | Enabled | |
Keys.End | Enabled | - | |
Keys.Home | Enabled | - | |
Keys.Left | Enabled | - | |
Keys.Right | Enabled | - | |
Keys.Up | Enabled | - | |
Keys.Down | Enabled | - | |
Keys.Insert | - | - | |
Keys.Delete | Enabled | - | |
Keys.BackSpace | Enabled | - | |
Keys.Control | Keys.PageUp | - | - |
Keys.PageDown | - | - | |
Keys.End | - | Enabled | |
Keys.Home | - | Enabled | |
Keys.Left | Enabled | - | |
Keys.Right | Enabled | - | |
Keys.Up | - | Enabled | |
Keys.Down | - | Enabled | |
Keys.A | Enabled | - | |
Keys.C | Enabled | - | |
Keys.V | Enabled | - | |
Keys.X | Enabled | - | |
Keys.Shift | Keys.Left | Enabled | - |
Keys.Right | Enabled | - | |
Keys.Up | Enabled | - | |
Keys.Down | Enabled | - | |
Keys.Home | Enabled | - | |
Keys.End | Enabled | - |
When multiple cells are selected, Keys.Control + Keys.C is processed by the GcMultiRow control. |
You can use the GcMultiRow.CellContentClick event to get a click in the cell content area. Use the GcMultiRow.CellContentDoubleClick event for a double-click. Use the GcMultiRow.CellEditedFormattedValueChanged event to handle changes to the cell. MaskedTextBoxEditingControl class events can be used handle processing when the masked text box cell is being edited.
The table below shows a comparison between major properties of the masked text box cell and the System.Windows.Forms.MaskedTextBox control.
MaskedTextBoxCell | MaskedTextBox |
---|---|
AllowPromptAsInput | AllowPromptAsInput |
AsciiOnly | AsciiOnly |
BeepOnError | BeepOnError |
Culture | Culture |
CutCopyMaskFormat | CutCopyMaskFormat |
Style.FormatProvider | FormatProvider |
DisplayTextMaskFormat | None |
None | HidePromptOnLeave |
InsertKeyMode | InsertKeyMode |
None | IsOverwriteMode |
Mask | Mask |
MaskCompleted | MaskCompleted |
MaskedTextProvider | MaskedTextProvider |
MaskFull | MaskFull |
PasswordChar | PasswordChar |
PromptChar | PromptChar |
RejectInputOnFirstFailure | RejectInputOnFirstFailure |
ResetOnPrompt | ResetOnPrompt |
ResetOnSpace | ResetOnSpace |
None | SelectedText |
SkipLiterals | SkipLiterals |
DisplayText | Text |
Style.TextAlign | TextAlign |
None | TextLength |
TextMaskFormat | TextMaskFormat |
UseSystemPasswordChar | UseSystemPasswordChar |
None | ValidatingType |