protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Oemcomma || e.KeyCode == Keys.Return || e.KeyCode == Keys.Space) { this.SetFocusEditorIndex((this.focusEditor + 1) % this.editor.Length, true); e.Handled = true; } else if ((e.KeyCode == Keys.C || e.KeyCode == Keys.X) && e.Control) { if (this.focusEditor == -1) { string valString = this.editor.Select(ve => ve.Value).ToString(", "); DataObject data = new DataObject(); data.SetText(valString); data.SetWrappedData(this.DisplayedValue); Clipboard.SetDataObject(data); this.SetFocusEditorIndex(-1, true); if (e.KeyCode == Keys.X) { for (int i = 0; i < this.editor.Length; i++) this.editor[i].Value = 0; } e.Handled = true; } else { this.editor[this.focusEditor].OnKeyDown(e); } } else if (e.KeyCode == Keys.V && e.Control) { if (this.focusEditor == -1) { DataObject data = Clipboard.GetDataObject() as DataObject; bool success = false; if (data.GetWrappedDataPresent(this.DisplayedValue.GetType())) { object stored = data.GetWrappedData(this.DisplayedValue.GetType()); this.SetValue(stored); this.PerformGetValue(); this.OnEditingFinished(FinishReason.LeapValue); this.SetFocusEditorIndex(-1, true); success = true; } else if (data.ContainsText()) { string valString = data.GetText(); string[] token = valString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < Math.Min(token.Length, this.editor.Length); i++) { token[i] = token[i].Trim(); decimal val; if (decimal.TryParse(token[i], out val)) { this.editor[i].Value = val; success = true; } } if (success) { this.PerformSetValue(); this.PerformGetValue(); this.OnEditingFinished(FinishReason.LeapValue); this.SetFocusEditorIndex(-1, true); } } if (!success) System.Media.SystemSounds.Beep.Play(); e.Handled = true; } else { this.editor[this.focusEditor].OnKeyDown(e); } } else { if (this.focusEditor != -1) this.editor[this.focusEditor].OnKeyDown(e); else { for (int i = 0; i < this.editor.Length; i++) { this.editor[i].OnKeyDown(e); if (e.Handled) { this.SetFocusEditorIndex(i, false); break; } } } } base.OnKeyDown(e); }