void popupMenu_Opening(object sender, CancelEventArgs e) { //---block autocomplete menu for comments //get index of green style (used for comments) if (CurrentTB.Selection.Start.iChar > 0) { //current char (before caret) var c = CurrentTB[CurrentTB.Selection.Start.iLine][CurrentTB.Selection.Start.iChar - 1]; //if char contains green style then block popup menu if (CurrentTB.CharHasStyle(c, CurrentTB.SyntaxHighlighter.GreenStyle)) { e.Cancel = true; } } }