/// <summary> /// Return true to handle the keypress, return false to let the text area handle the keypress /// </summary> void TextAreaKeyEventHandler(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.OemOpenBrackets && e.Shift) { ICompletionDataProvider snippetDataProvider = new SnippetDataProvider(mainForm.AutoCompleteImageList); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( mainForm, // The parent window for the completion window editor, // The text editor to show the window for "", // Filename - will be passed back to the provider snippetDataProvider, // Provider to get the list of possible completions Convert.ToChar(e.KeyCode) // Key pressed - will be passed to the provider ); } else { ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(mainForm.AutoCompleteImageList); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( mainForm, // The parent window for the completion window editor, // The text editor to show the window for "", // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions Convert.ToChar(e.KeyCode) // Key pressed - will be passed to the provider ); } if (codeCompletionWindow != null) { // ShowCompletionWindow can return null when the provider returns an empty list codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } return; }
private void ShowIntellisense() { ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(this.AutoCompleteImageList); var x = CodeCompletionWindow.ShowCompletionWindow( this, // The parent window for the completion window txtCode, // The text editor to show the window for "", // Filename - will be passed back to the provider completionDataProvider,// Provider to get the list of possible completions ' ' // Key pressed - will be passed to the provider ); if (codeCompletionWindow != null) { // ShowCompletionWindow can return null when the provider returns an empty list codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } }