Udostępnij za pośrednictwem


ImageMap Web Server Control Overview

The ASP.NET ImageMap control enables you to create an image that has individual regions that users can click, which are called hot spots. Each of these hot spots can be a separate hyperlink or postback event.

This topic contains:

  • Background

  • Code Examples

  • Class Reference

Background

The ImageMap control consists of two pieces. The first is an image, which can be a graphic in any standard Web graphic format, such as a .gif, .jpg, or .png file.

The second element is a collection of HotSpot controls. Each hot-spot control is a different item that is of type CircleHotSpot, RectangleHotSpot, or PolygonHotSpot. For each hot-spot control, you define the coordinates that specify the location and size of the hot spot. For example, if you create a CircleHotSpot control, you define the x-coordinates and y-coordinates of the circle's center and the circle's radius.

You can define as many or as few hot spots for the image as you require. You do not have to define hot spots to cover the graphic entirely.

Note

You can define overlapping hot spots. Each hot spot has a z-index value. If a user clicks an area that is defined by two or more overlapping hot spots, the hot spot with the highest z-order is the hot spot that is selected.

Responding to User Clicks

You can specify what happens when a user clicks a hot spot. You can configure each hot spot as a hyperlink that goes to a URL that you provide for that hot spot. Alternatively, you can configure the control to perform a postback when a user clicks a hot spot, and provide a unique value for each hot spot. The postback raises the ImageMap control's Click event. In the event handler, you can read the unique value that you assign to each hot spot.

Back to top

Code Examples

How to: Add ImageMap Web Server Controls to a Web Page

How to: Respond to User Clicks in ImageMap Web Server Controls

Back to top

Class Reference

The following table lists the classes that relate to the ImageMap control.

Member

Description

ImageMap

The main class for the control.

CircleHotSpot

Represents an individual hotspot that is a circle.

RectangleHotSpot

Represents an individual hotspot that is a rectangle.

PolygonHotSpot

Represents an individual hotspot that is a polygon.

Back to top

See Also

Reference

Image Web Server Control Overview