GrapeCity.Win.MultiRow Namespace > IEditingCell Interface : EditingCellFormattedValue Property |
Property EditingCellFormattedValue As Object
Dim instance As IEditingCell Dim value As Object instance.EditingCellFormattedValue = value value = instance.EditingCellFormattedValue
object EditingCellFormattedValue {get; set;}
public object EditingCellFormattedValue { get { return _editingValue; } set { if ((int)value < this.Minimum) { value = Minimum; } else if ((int)value > this.Maximum) { value = Maximum; } if (_editingValue != (int)value) { _editingValue = (int)value; // When changing the editing cell's value, the cell should fire EditingCellValueChanged event to notify MultiRow control. // When leaving edit mode, MultiRow uses this value as cell's new value. this.OnEditingCellValueChanged(EventArgs.Empty); // Notify MultiRow control to redraw this cell. this.Invalidate(); } } } public event EventHandler EditingCellValueChanged; protected virtual void OnEditingCellValueChanged(EventArgs e) { if (this.EditingCellValueChanged != null) { this.EditingCellValueChanged(this, e); } } protected override void OnCellFormatting(CellFormattingEventArgs e) { // When multiRow repaints cell, the cell gets the paint value. // The cell should use the EditingCellFormattedValue property value to paint the cell, if the cell is in edit mode. // Change the override OnPaint method to customize the cell painting logic for edit status, // if so, overriding OnCellFormatting is not necessary. if (this.GcMultiRow.IsCurrentCellInEditMode && this.GcMultiRow.CurrentCell.RowIndex == e.RowIndex && this.GcMultiRow.CurrentCell.CellIndex == e.CellIndex) { e.Value = this.EditingCellFormattedValue; } base.OnCellFormatting(e); }
Public Property EditingCellFormattedValue() As Object Implements IEditingCell.EditingCellFormattedValue Get Return _editingValue End Get Set(ByVal value As Object) If DirectCast(value, Integer) < Me.Minimum Then value = Minimum ElseIf DirectCast(value, Integer) > Me.Maximum Then value = Maximum End If If _editingValue <> DirectCast(value, Integer) Then _editingValue = DirectCast(value, Integer) ' When changing the editing cell's value, the cell should fire the EditingCellValueChanged event to notify the MultiRow control. ' When leaving edit mode, MultiRow uses this value as the cell's new value. Me.OnEditingCellValueChanged(EventArgs.Empty) ' Notify MultiRow control redraw this cell. Me.Invalidate() End If End Set End Property Public Event EditingCellValueChanged As EventHandler Implements IEditingCell.EditingCellValueChanged Protected Overridable Sub OnEditingCellValueChanged(ByVal e As EventArgs) RaiseEvent EditingCellValueChanged(Me, e) End Sub Protected Overloads Overrides Sub OnCellFormatting(ByVal e As CellFormattingEventArgs) ' When multiRow repaints the cell, the cell gets the paint value. ' The cell should use the EditingCellFormattedValue property value to paint the cell, if the cell is in edit mode. ' You can override the OnPaint method to customize the cell painting logic for edit mode. ' If so, overriding OnCellFormatting is not necessary. If Me.GcMultiRow.IsCurrentCellInEditMode AndAlso Me.GcMultiRow.CurrentCell.RowIndex = e.RowIndex AndAlso Me.GcMultiRow.CurrentCell.CellIndex = e.CellIndex Then e.Value = Me.EditingCellFormattedValue End If MyBase.OnCellFormatting(e) End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2