示例#1
0
        protected override void OnMouseDown(MouseEventArgs mea)
        {
            base.OnMouseDown(mea);			// allow base to process first
            _MousePosition = new Point(mea.X, mea.Y);

            if (MouseDownRubberBand(mea))
                return;

            HitListEntry hle = this.GetHitListEntry(mea);
            SetHitListCursor(hle);			// set the cursor based on the hit list entry

            if (mea.Button != MouseButtons.Left || hle == null)
                return;

            if (hle.pi.HyperLink != null)
            {
                Viewer rv = this.Parent as Viewer;
                bool bInvoke = true;
                if (rv != null)
                {
                    HyperlinkEventArgs hlea = new HyperlinkEventArgs(hle.pi.HyperLink);
                    rv.InvokeHyperlink(hlea);     // reset any mousemove
                    bInvoke = !hlea.Cancel;
                }
                try
                {
                    if (bInvoke)
                        System.Diagnostics.Process.Start(hle.pi.HyperLink);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Unable to link to {0}{1}{2}",
                        hle.pi.HyperLink, Environment.NewLine, ex.Message), "HyperLink Error");
                }
            }
        }
示例#2
0
 internal void InvokeHyperlink(HyperlinkEventArgs hlea)
 {
     if (Hyperlink != null)
         Hyperlink(this, hlea);
 }