/// <include file='doc\DataGridTextBoxColumn.uex' path='docs/doc[@for="DataGridTextBoxColumn.Edit"]/*' /> /// <devdoc> /// <para>Prepares a cell for editing.</para> /// </devdoc> protected internal override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string displayText, bool cellIsVisible) { DebugOut("Begining Edit, rowNum :" + rowNum.ToString(CultureInfo.InvariantCulture)); Rectangle originalBounds = bounds; edit.ReadOnly = readOnly || ReadOnly || this.DataGridTableStyle.ReadOnly; edit.Text = GetText(GetColumnValueAtRow(source, rowNum)); if (!edit.ReadOnly && displayText != null) { // tell the grid that we are changing stuff this.DataGridTableStyle.DataGrid.ColumnStartedEditing(bounds); // tell the edit control that the user changed it this.edit.IsInEditOrNavigateMode = false; edit.Text = displayText; } if (cellIsVisible) { bounds.Offset(xMargin, 2 * yMargin); bounds.Width -= xMargin; bounds.Height -= 2 * yMargin; DebugOut("edit bounds: " + bounds.ToString()); edit.Bounds = bounds; edit.Visible = true; edit.TextAlign = this.Alignment; } else { edit.Bounds = Rectangle.Empty; // edit.Bounds = originalBounds; // edit.Visible = false; } edit.RightToLeft = this.DataGridTableStyle.DataGrid.RightToLeft; edit.FocusInternal(); editRow = rowNum; if (!edit.ReadOnly) { oldValue = edit.Text; } // select the text even if the text box is read only // because the navigation code in the DataGridTextBox::ProcessKeyMessage // uses the SelectedText property if (displayText == null) { edit.SelectAll(); } else { int end = edit.Text.Length; edit.Select(end, 0); } if (edit.Visible) { DataGridTableStyle.DataGrid.Invalidate(originalBounds); } }