public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); clsUniformDataEditor ctl = DataGridView.EditingControl as clsUniformDataEditor; if (Value == null) { ctl.Text = "<Float> 0"; } else { ctl.Text = Value.ToString(); } }
public override void DetachEditingControl() { DataGridView dataGridView = this.DataGridView; if (dataGridView == null || dataGridView.EditingControl == null) { throw new InvalidOperationException("Cell is detached or its grid has no editing control."); } clsUniformDataEditor ctl = DataGridView.EditingControl as clsUniformDataEditor; if (ctl != null) { Value = ctl.Text; DataUniformType = ctl.DataUniformType; ctl.Parent = ctl.EditingPanel; ctl.EditingPanel = null; } base.DetachEditingControl(); }
public override void PositionEditingControl(bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) { clsUniformDataEditor ctl = DataGridView.EditingControl as clsUniformDataEditor; if (ctl == null) { return; } if (ctl.Parent != DataGridView.EditingPanel) { return; } ctl.Parent = ctl.ParentForm; Rectangle ctlSize = new Rectangle(new Point(cellBounds.Location.X, cellBounds.Location.Y), new Size(Math.Max(cellBounds.Width, 400), cellBounds.Height)); base.PositionEditingControl(setLocation, setSize, ctlSize, ctlSize, cellStyle, singleVerticalBorderAdded, singleHorizontalBorderAdded, isFirstDisplayedColumn, isFirstDisplayedRow); ctl.Location = ctl.Parent.PointToClient(DataGridView.PointToScreen(cellBounds.Location)); ctl.UpdateAutoHeight(); ctl.EditingPanel = DataGridView.EditingPanel; ctl.BringToFront(); }