/// <summary> /// Adjust the scrollbar of the panel on html element by the given id.<br/> /// The top of the html element rectangle will be at the top of the panel, if there /// is not enough height to scroll to the top the scroll will be at maximum.<br/> /// </summary> /// <param name="elementId">the id of the element to scroll to</param> public virtual void ScrollToElement(string elementId) { ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId"); if (_htmlContainer != null) { var rect = _htmlContainer.GetElementRectangle(elementId); if (rect.HasValue) { UpdateScroll(Point.Round(rect.Value.Location)); _htmlContainer.HandleMouseMove(this, new MouseEventArgs(MouseButtons, 0, MousePosition.X, MousePosition.Y, 0)); } } }
/// <summary> /// Handle mouse move to handle hover cursor and text selection. /// </summary> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (_htmlContainer != null) { _htmlContainer.HandleMouseMove(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)); } }