public void ShowAutoComplete(ITextAutoCompletionList list) { if (this._autoCompleteForm == null) { this._autoCompleteForm = new AutoCompleteForm(this, this._owner, this._location, list); int x = (((this._fontWidth * (this.GetViewIndex(this._location) - this.ViewLeftIndex)) + this.MarginPadding) + this.MarginWidth) + this._lineNumbersWidth; int y = ((this._location.LineIndex + 1) - this.ViewTopLineNumber) * this._fontHeight; this._autoCompleteForm.TopLevel = false; this._autoCompleteForm.Parent = this; if ((this._autoCompleteForm.Height + y) > base.Height) { y = (y - this._autoCompleteForm.Height) - this._fontHeight; if (y < 0) { this._autoCompleteForm = null; return; } } if ((this._autoCompleteForm.Width + x) > base.Width) { x -= this._autoCompleteForm.Width; if (x < 0) { this._autoCompleteForm = null; return; } } this._autoCompleteForm.Location = new Point(x, y); this._autoCompleteForm.Closed += new EventHandler(this.OnAutoCompleteFormClosed); this._autoCompleteForm.Show(); this._owner.Focus(); } this.AddCommandHandler(this._autoCompleteForm); }
private void OnAutoCompleteFormClosed(object sender, EventArgs e) { this._autoCompleteForm.Closed -= new EventHandler(this.OnAutoCompleteFormClosed); if (this._autoCompleteForm.DialogResult == DialogResult.OK) { this.HandleCommand(new TextBufferCommand(4, this._location, this._autoCompleteForm.PickedItemSuffix)); } ((IDisposable) this._autoCompleteForm).Dispose(); this._autoCompleteForm = null; this._owner.Focus(); }