protected virtual void Dispose(bool disposing) { if (this.textEditor != null) { this.parent.Controls.Remove(this.textEditor); this.textEditor.Dispose(); this.textEditor = null; this.textEditor = null; } if (this.cset != null) { this.cset.Builder = null; this.cset.Dispose(); this.cset = null; } // do NOT dispose this guy, it's owned by someone else. this.editor = null; }
public TextEditorOverlay(Control parent) { this.parent = parent; this.textEditor = new TextBox(); string name = parent.Name + "Editor"; this.textEditor.Name = name; this.textEditor.AccessibleName = name; this.textEditor.Visible = false; this.textEditor.BorderStyle = BorderStyle.None; this.textEditor.BackColor = Color.LightSteelBlue; this.textEditor.AutoSize = false; this.textEditor.Multiline = true; // this fixes layout problems in single line case also. this.textEditor.Margin = new Padding(1, 0, 0, 0); this.textEditor.HideSelection = false; parent.Controls.Add(this.textEditor); this.textEditor.KeyDown += new KeyEventHandler(editor_KeyDown); this.textEditor.LostFocus += new EventHandler(editor_LostFocus); this.textEditor.GotFocus += new EventHandler(editor_GotFocus); this.textEditor.TextChanged += new EventHandler(editor_TextChanged); this.currentEditor = this.textEditor; this.cset = new CompletionSet(this.textEditor); this.cset.KeyDown += new KeyEventHandler(editor_KeyDown); this.cset.DoubleClick += new EventHandler(cset_DoubleClick); }