Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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
PictureCollection.AddPicture Inserts a picture from a file or a SpreadsheetImageSource object to fit in the specified range.
Shape.InsertHyperlink Creates a new ShapeHyperlink object with the passed hyperlink destination. The hyperlink can refer to a web page, existing file or directory, e-mail address or cell range.
HyperlinkBase.TooltipText Specifies the hyperlink’s tooltip.This text is displayed when the cursor hovers over the picture.

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

Spreadsheet_ShapeHyperlink

Workbook workbook = new Workbook();
Picture picture = workbook.Worksheets[0].Pictures.AddPicture("DevExpress.png", workbook.Worksheets[0].Cells["A1"]);
ShapeHyperlink shapeHyperlink = picture.InsertHyperlink("https://community.devexpress.com/blogs/", true);
shapeHyperlink.TooltipText = "Check the recent DevExpress blogs";