How to: Add a Hyperlink to a Picture

This example demonstrates how to associate a hyperlink with a picture using the following API.

Member Description
ShapeCollection.InsertPicture Inserts a picture.
Shape.AddHyperlink Creates a new Hyperlink object associated with a picture.
Hyperlink.NavigateUri Specifies the destination to which the hyperlink should refer.
Hyperlink.Tooltip Adds a tooltip to the hyperlink. This text is displayed when the cursor hovers over the picture.

The code sample below inserts a picture and attaches a hyperlink to it.


Document document = richEditControl1.Document;
Shape picture = document.Shapes.InsertPicture(richEditControl1.Document.Range.Start, DocumentImageSource.FromFile("Documents//DevExpress.png"));
Hyperlink pictureHyperlink = picture.AddHyperlink();
pictureHyperlink.NavigateUri = "";
pictureHyperlink.ToolTip = "Check the recent DevExpress blogs";