MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Types > TextBoxCell |
The text box cell has features similar to the .NET Framework's TextBox control (System.Windows.Forms.TextBox). The user can use the text box cell to type text in a cell.
In addition to the Base Cell features, the following features can also be used in the text box cell.
For more details on each feature, refer to the TextBoxCell class.
The text box cell uses the Object type value. This type can be checked with the TextBoxCell.ValueType property. The value cast into the String type is used for input and display. This type can be checked with the TextBoxCell.FormattedValueType property. The behavior during casting can be modified by overriding the ToString Object type method. You can override the TextBoxCell.OnCellFormatting method to modify the behavior when values are read in a cell. Override the TextBoxCell.OnCellParsing method to modify the behavior when a value is written back from the cell.
The text box cell value is edited in the TextBoxEditingControl control. This control is inherited from the IEditingControl interface and System.Windows.Forms.TextBox Class. The cell edit control type can be checked with the TextBoxCell.EditType property.
The text box cell supports the following CellStyle class members. The cell style is set with the TextBoxCell.Style property.
CellStyle Member | Non-Editable State | Editable State |
---|---|---|
BackColor | Enabled | Enabled |
BackgroundGradientEffect | Enabled | - |
Border | Enabled | Enabled |
DataSourceNullValue | Enabled | Enabled |
DisabledBackColor | Enabled | - |
DisabledForeColor | Enabled | - |
DisabledGradientEffect | Enabled | - |
EditingBackColor | - | Enabled |
EditingForeColor | - | Enabled |
Font | Enabled | Enabled |
ForeColor | Enabled | Enabled |
Format | Enabled | Enabled |
FormatProvider | Enabled | Enabled |
Image | Enabled | - |
ImageAlign | Enabled | - |
ImeMode | Enabled | Enabled |
ImeSentenceMode | Enabled | Enabled |
InputScope | Enabled | Enabled |
LineAdjustment | Enabled only for GDI+Compatible Mode | - |
Margin | Enabled | Enabled |
MouseOverBackColor | Enabled | - |
MouseOverForeColor | Enabled | - |
MouseOverGradientEffect | Enabled | - |
Multiline | Enabled | Enabled |
NullValue | Enabled | Enabled |
Padding | Enabled | Enabled |
PatternColor | Enabled | - |
PatternStyle | Enabled | - |
SelectionBackColor | Enabled | - |
SelectionForeColor | Enabled | - |
SelectionGradientEffect | Enabled | - |
Tag | Enabled | Enabled |
TextAdjustment | Enabled only for GDI+Compatible Mode | - |
TextAlign | Enabled | Only 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 | Enabled |
To enable GDI+ Compatibility Mode, set the TextBoxCell.Style.UseCompatibleTextRendering property to True.
The following table lists keys processed during the editing of the text box cell and lists keys processed by the GcMultiRow control.
Modifier | Key | TextBoxCell | 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 | - | |
Keys.Enter | Enabled only for Multiline | - | |
Keys.F10 | Enabled | - |
|
You can use the GcMultiRow.CellContentClick event to implement processing when clicking in the cell content area. Use the GcMultiRow.CellContentDoubleClick event for a double-click. Use the GcMultiRow.CellEditedFormattedValueChanged event to get cell value changes. The TextBoxEditingControl class events are used to implement processing in the text box cell edit state.
The table below shows a comparison between major properties of the text box cell and the System.Windows.Forms.TextBox control (System.Windows.Forms.DataGridViewTextBoxCell class).
TextBoxCell | TextBox | DataGridViewTextBoxCell |
---|---|---|
None | AcceptsReturns | None |
None | AutoCompleteCustomSource | None |
None | AutoCompleteMode | None |
None | AutoCompleteSource | None |
Style.BackColor | BackColor | Style.BackColor |
CharacterCasing | CharacterCasing | None |
Style.ForeColor | ForeColor | Style.ForeColor |
MaxLength | MaxLength | MaxInputLength |
Style.MultiLine | MultiLine | None |
PasswordChar | PasswordChar | None |
ScrollBars | ScrollBars | None |
Value | Text | Value |
Style.TextAlign | TextAlign | Style.Alignment |
UseSystemPasswordChar | UseSystemPasswordChar | None |
Style.WordWrap | WordWrap | Style.WrapMode |
For more information, see the following topics: