[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Viewer.Win.Viewer.HyperLink

HyperLink Event

Occurs when the user clicks on text or an image that has a hyperlink assigned to it.

Namespace: GrapeCity.ActiveReports.Viewer.Win
Assembly: MESCIUS.ActiveReports.Viewer.Win.dll
public event HyperLinkEventHandler HyperLink
Returns
Type Description
HyperLinkEventHandler Occurs when the user clicks on text or an image that has a hyperlink assigned to it.

The HyperLinkEventArgs provides information about the hyperlink, including its URL. Event handlers can use this information to perform custom actions, such as navigating to the hyperlink or displaying it in a web browser.

public partial class MyForm : Form
{
	private Viewer viewer;
	public MyForm()
	{
		InitializeComponent();
		// Initialize the viewer
		viewer = new Viewer();
		this.Controls.Add(viewer);
		// Subscribe to the HyperLink event
		viewer.HyperLink += Viewer_HyperLink;
	}

	private void Viewer_HyperLink(object sender, HyperLinkEventArgs e)
	{
		// Check if the hyperlink is not null or empty
		if (!string.IsNullOrEmpty(e.HyperLink))
		{
		    // Open the hyperlink in the default web browser
		    System.Diagnostics.Process.Start(e.HyperLink);
		    // Optionally, set Handled to true to prevent the default behavior
		    e.Handled = true;
		}
	}
}