void TextAreaLostFocus(object sender, EventArgs e) { // The call to ShowHiddenCursorIfMovedOrLeft is delayed until pending messages have been processed // so that it can properly detect whether the TextArea has really lost focus. // For example, the CodeCompletionWindow gets focus when it is shown, but immediately gives back focus to the TextArea. _textArea.BeginInvoke(new MethodInvoker(ShowHiddenCursorIfMovedOrLeft)); }