Skip to main content
A newer version of this page is available. .

How to: Add a Hyperlink to a Picture

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

Member Description
ShapeCollection.InsertPicture Inserts a floating picture.
Shape.AddHyperlink Creates a new Hyperlink object associated with a shape.
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.

XtraRichEdit_HyperlinkPicture


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