private void scriptedit_KeyUp(object sender, KeyEventArgs e) { bool showcalltip = false; int highlightstart = 0; int highlightend = 0; UpdatePositionInfo(); // Call tip shown if (scriptedit.CallTipActive) { // Should we hide the call tip? if (curfunctionname.Length == 0) { // Hide the call tip scriptedit.CallTipCancel(); } else { // Update the call tip showcalltip = true; } } // No call tip else { // Should we show a call tip? showcalltip = (curfunctionname.Length > 0) && !scriptedit.AutoCActive; } // Show or update call tip if (showcalltip) { string functiondef = scriptconfig.GetFunctionDefinition(curfunctionname); if (functiondef != null) { // Determine the range to highlight int argsopenpos = functiondef.IndexOf(scriptconfig.FunctionOpen, StringComparison.Ordinal); int argsclosepos = functiondef.LastIndexOf(scriptconfig.FunctionClose, StringComparison.Ordinal); if ((argsopenpos > -1) && (argsclosepos > -1)) { string argsstr = functiondef.Substring(argsopenpos + 1, argsclosepos - argsopenpos - 1); string[] args = argsstr.Split(scriptconfig.ArgumentDelimiter[0]); if ((curargumentindex >= 0) && (curargumentindex < args.Length)) { int argoffset = 0; for (int i = 0; i < curargumentindex; i++) { argoffset += args[i].Length + 1; } highlightstart = argsopenpos + argoffset + 1; highlightend = highlightstart + args[curargumentindex].Length; } } // Determine callip position int tippos = curfunctionstartpos; int funcline = scriptedit.LineFromPosition(curfunctionstartpos); //mxd. If the tip obscures the view, move it down if (scriptedit.CurrentLine > funcline) { int offset = curfunctionstartpos - scriptedit.Lines[funcline].Position; tippos = scriptedit.Lines[scriptedit.CurrentLine].Position + offset; } //mxd. Take line wrapping into account if (scriptedit.Lines[scriptedit.CurrentLine].WrapCount > 0) { int x = scriptedit.PointXFromPosition(tippos); int y = scriptedit.PointYFromPosition(scriptedit.CurrentPosition); int newtippos = scriptedit.CharPositionFromPointClose(x, y); if (newtippos != -1) { tippos = newtippos; } } // Show tip scriptedit.CallTipShow(tippos, functiondef); scriptedit.CallTipSetHlt(highlightstart, highlightend); } } }