HyperlinkEventArgs passed when a report item with a hyperlink defined is clicked on
Inheritance: System.ComponentModel.CancelEventArgs
Exemple #1
0
 void rdlViewer_Hyperlink(object source, HyperlinkEventArgs e)
 {
     if (MessageBox.Show(string.Format("Do you wish to invoke Hyperlink {0}", e.Hyperlink), "Hyperlink", MessageBoxButtons.YesNo)
         == DialogResult.No)
     {
         e.Cancel = true;
     }
 }
        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)
            {
                RdlViewer rv = this.Parent as RdlViewer;
                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("{3} {0}{1}{2}",
                        hle.pi.HyperLink, Environment.NewLine, ex.Message, Strings.PageDrawing_OnMouseDown_UnableLink), Strings.PageDrawing_OnMouseDown_HyperLinkError);
                }
            }
        }
 internal void InvokeHyperlink(HyperlinkEventArgs hlea)
 {
     if (Hyperlink != null)
         Hyperlink(this, hlea);
 }