/// <summary> /// Handle mouse up to handle selection and link click. /// </summary> protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseClick(e); if (_htmlContainer != null) { _htmlContainer.HandleMouseUp(this, e); } }
/// <summary> /// Raised on link handling timer tick, used for: /// 1. Know when the tooltip is hidden by checking the visibility of the tooltip window. /// 2. Call HandleMouseMove so the mouse cursor will react if over a link element. /// 3. Call HandleMouseDown and HandleMouseUp to simulate click on a link if one was clicked. /// </summary> protected virtual void OnLinkHandlingTimerTick(EventArgs e) { try { var handle = _tooltipHandle; if (handle != IntPtr.Zero && Win32Utils.IsWindowVisible(handle)) { var mPos = Control.MousePosition; var mButtons = Control.MouseButtons; var rect = Win32Utils.GetWindowRectangle(handle); if (rect.Contains(mPos)) { _htmlContainer.HandleMouseMove(_associatedControl, new MouseEventArgs(mButtons, 0, mPos.X - rect.X, mPos.Y - rect.Y, 0)); } } else { _linkHandlingTimer.Stop(); _tooltipHandle = IntPtr.Zero; var mPos = Control.MousePosition; var mButtons = Control.MouseButtons; var rect = Win32Utils.GetWindowRectangle(handle); if (rect.Contains(mPos)) { if (mButtons == MouseButtons.Left) { var args = new MouseEventArgs(mButtons, 1, mPos.X - rect.X, mPos.Y - rect.Y, 0); _htmlContainer.HandleMouseDown(_associatedControl, args); _htmlContainer.HandleMouseUp(_associatedControl, args); } } } } catch (Exception ex) { OnRenderError(this, new HtmlRenderErrorEventArgs(HtmlRenderErrorType.General, "Error in link handling for tooltip", ex)); } }