C# Class SIL.FieldWorks.Common.Widgets.FwTextBoxCell

Displays editable text information from a FwTextBox in a DataGridView control.
Inheritance: System.Windows.Forms.DataGridViewTextBoxCell
Exibir arquivo Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
FwTextBoxCell ( ) : System

Initializes a new instance of the T:FwTextBoxCell class.

InitializeEditingControl ( int rowIndex, object initialFormattedValue, System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle ) : void

Attaches and initializes the hosted editing control.

ParseFormattedValue ( object formattedValue, System.Windows.Forms.DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter ) : object

Get the ITsString

Get the ITsString from the text box control rather than trying to parse/convert it from the string - there is no type converter that could do it and we would need to know the writing system etc. NOTE: formattedValue contains either the new value or the previous value (if the user cancels). This solution always returns the new value. However, this is currently not a problem because Cancel is handled by the dialog.

Protected Methods

Method Description
GetFormattedValue ( object value, int rowIndex, System.Windows.Forms.DataGridViewCellStyle &cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context ) : object

Gets the text value of the cell's TsString and uses it as the value to display.

Paint ( Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object val, object formattedValue, string errorText, System.Windows.Forms.DataGridViewCellStyle cellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts ) : void

Paint this DataGridView cell. Overridden to allow RightToLeft display if needed.

Private Methods

Method Description
DrawFwText ( Graphics graphics, Rectangle cellBounds, string text, System.Windows.Forms.DataGridViewCellStyle cellStyle, FwTextBoxColumn col ) : void

Draw the text using the FieldWorks IVwGraphicsWin32 interface.

GetLocationForText ( Rectangle cellBounds, bool fRightToLeft, IVwGraphicsWin32 vg, string text, int &x, int &y ) : void

Get the starting location for drawing the text.

GetRenderProps ( System.Windows.Forms.DataGridViewCellStyle cellStyle, FwTextBoxColumn col ) : LgCharRenderProps
InitializeTextBoxControl ( SIL.FieldWorks.Common.Widgets.FwTextBoxControl ctrl, int rowIndex ) : void

Initializes the text box control.

rowIndex is usually the same as RowIndex, except in the case of a shared row (in which case RowIndex is always -1).

Method Details

FwTextBoxCell() public method

Initializes a new instance of the T:FwTextBoxCell class.
public FwTextBoxCell ( ) : System
return System

GetFormattedValue() protected method

Gets the text value of the cell's TsString and uses it as the value to display.
Formatting failed and either there is no /// handler for the event /// of the control or the /// handler set the /// property to true. The exception object can typically be cast to type /// .
protected GetFormattedValue ( object value, int rowIndex, System.Windows.Forms.DataGridViewCellStyle &cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context ) : object
value object The value to be formatted.
rowIndex int The index of the cell's parent row.
cellStyle System.Windows.Forms.DataGridViewCellStyle The /// in effect for the cell.
valueTypeConverter System.ComponentModel.TypeConverter A /// associated with the value type that provides custom conversion to the formatted value /// type, or null if no such custom conversion is needed.
formattedValueTypeConverter System.ComponentModel.TypeConverter A /// associated with the formatted value type that provides custom conversion from the value /// type, or null if no such custom conversion is needed.
context DataGridViewDataErrorContexts A bitwise combination of /// values describing /// the context in which the formatted value is needed.
return object

InitializeEditingControl() public method

Attaches and initializes the hosted editing control.
public InitializeEditingControl ( int rowIndex, object initialFormattedValue, System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle ) : void
rowIndex int The index of the row being edited.
initialFormattedValue object The initial value to be displayed in the /// control.
dataGridViewCellStyle System.Windows.Forms.DataGridViewCellStyle A cell style that is used to determine the /// appearance of the hosted control.
return void

Paint() protected method

Paint this DataGridView cell. Overridden to allow RightToLeft display if needed.
protected Paint ( Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object val, object formattedValue, string errorText, System.Windows.Forms.DataGridViewCellStyle cellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts ) : void
graphics System.Drawing.Graphics
clipBounds System.Drawing.Rectangle
cellBounds System.Drawing.Rectangle
rowIndex int
cellState DataGridViewElementStates
val object
formattedValue object
errorText string
cellStyle System.Windows.Forms.DataGridViewCellStyle
advancedBorderStyle System.Windows.Forms.DataGridViewAdvancedBorderStyle
paintParts DataGridViewPaintParts
return void

ParseFormattedValue() public method

Get the ITsString
Get the ITsString from the text box control rather than trying to parse/convert it from the string - there is no type converter that could do it and we would need to know the writing system etc. NOTE: formattedValue contains either the new value or the previous value (if the user cancels). This solution always returns the new value. However, this is currently not a problem because Cancel is handled by the dialog.
public ParseFormattedValue ( object formattedValue, System.Windows.Forms.DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter ) : object
formattedValue object The display value of the cell.
cellStyle System.Windows.Forms.DataGridViewCellStyle The /// in effect for the cell.
formattedValueTypeConverter System.ComponentModel.TypeConverter A /// for the display value type, or null to use the default converter.
valueTypeConverter System.ComponentModel.TypeConverter A /// for the cell value type, or null to use the default converter.
return object