示例#1
0
        /// <summary>
        /// Handle mouse up to handle selection and link click.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="e">the mouse event args</param>
        public void HandleMouseUp(Control parent, MouseEventArgs e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");
            ArgChecker.AssertArgNotNull(e, "e");

            if (_selectionHandler != null)
            {
                var inSelection = _selectionHandler.HandleMouseUp(parent, e.Button);
                if (!inSelection && (e.Button & MouseButtons.Left) != 0)
                {
                    var loc  = OffsetByScroll(e.Location);
                    var link = DomUtils.GetLinkBox(_root, loc);
                    if (link != null)
                    {
                        if (LinkClicked != null)
                        {
                            var args = new HtmlLinkClickedEventArgs(link.GetAttribute("href"));
                            LinkClicked(this, args);
                            if (args.Handled)
                            {
                                return;
                            }
                        }

                        CssValueParser.GoLink(link.GetAttribute("href", string.Empty), Bridge);
                    }
                }
            }
        }