private void ScintillaSrc_DwellStart(object sender, ScintillaNET.DwellEventArgs e) { var highlight = highlights.FirstOrDefault(h => h.Start <= e.Position && e.Position <= h.End); if (highlight != null) { scintilla.CallTipShow(highlight.Start, highlight.Message); } }
/// <summary> /// Raises the <see cref="DwellStart" /> event. /// </summary> /// <param name="e">A <see cref="DwellEventArgs" /> that contains the event data.</param> protected virtual void OnDwellStart(DwellEventArgs e) { var handler = Events[dwellStartEventKey] as EventHandler<DwellEventArgs>; if (handler != null) handler(this, e); }
private void ScintillaSrc_DwellEnd(object sender, ScintillaNET.DwellEventArgs e) { scintilla.CallTipCancel(); }
/// <summary> /// Extends OnDwellStart to provide DwellOnIdentifier event /// </summary> /// <param name="e"></param> protected override void OnDwellStart(DwellEventArgs e) { bool isDebug = false; System.Diagnostics.Debug.Assert(isDebug = true); if (DwellOnIdentifier != null || isDebug) { var index = CharPositionFromPointClose(e.X, e.Y); if (index >= 0) { if (isDebug) System.Diagnostics.Debug.Print("Lexer style @{0}: {1}", index, GetStyleAt(index)); if (DwellOnIdentifier == null) return; string identifier = null; var identifierRange = default(CharacterRange); var visibleRange = default(CharacterRange); string visibleText = null; if (index >= 0) identifier = FindIdentifierAt(index, out identifierRange, out visibleRange, out visibleText); if (identifier != null) { var eventArgs = new DwellOnIdentifierEventArgs(identifier, identifierRange, visibleRange, visibleText); OnDwellOnIdentifier(eventArgs); if (!String.IsNullOrEmpty(eventArgs.CallTipText)) CallTipShow(identifierRange.First, eventArgs.CallTipText); else CallTipCancel(); } else CallTipCancel(); } else CallTipCancel(); } base.OnDwellStart(e); }