public virtual void StartCellEdit(OLVListItem item, int subItemIndex)
{
OLVColumn column = this.GetColumn(subItemIndex);
Control c = this.GetCellEditor(item, subItemIndex);
Rectangle r = this.CalculateCellEditorBounds(item, subItemIndex, c.PreferredSize);
c.Bounds = r;
// Try to align the control as the column is aligned. Not all controls support this property
Munger.PutProperty(c, "TextAlign", column.TextAlign);
// Give the control the value from the model
this.SetControlValue(c, column.GetValue(item.RowObject), column.GetStringValue(item.RowObject));
// Give the outside world the chance to munge with the process
this.cellEditEventArgs = new CellEditEventArgs(column, c, r, item, subItemIndex);
this.OnCellEditStarting(this.cellEditEventArgs);
if (this.cellEditEventArgs.Cancel)
return;
// The event handler may have completely changed the control, so we need to remember it
this.cellEditor = this.cellEditEventArgs.Control;
// If the control isn't the height of the cell, centre it vertically.
// We don't do this in OwnerDrawn mode since the renderer already aligns the control correctly.
// We also dont need to do this when in Tile view.
if (this.View != View.Tile && !this.OwnerDraw && this.cellEditor.Height != r.Height) {
this.cellEditor.Top += (r.Height - this.cellEditor.Height) / 2;
}
this.Invalidate();
this.Controls.Add(this.cellEditor);
this.ConfigureControl();
this.PauseAnimations(true);
}