This documentation is archived and is not being maintained.

ImageMap.HotSpots Property

Gets a collection of HotSpot objects that represents the defined hot spot regions in an ImageMap control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public HotSpotCollection HotSpots { get; }
/** @property */
public HotSpotCollection get_HotSpots ()

public function get HotSpots () : HotSpotCollection

Not applicable.

Property Value

A HotSpotCollection object that represents the defined hot spot regions in an ImageMap control.

Use the HotSpots property to programmatically manage the hot spot regions in an ImageMap control. You can use the HotSpots property to add, insert, remove, and retrieve HotSpot objects. For more information, see HotSpotCollection.

The following code example demonstrates how to programmatically create an ImageMap control and add two CircleHotSpot objects to it. The HotSpots property is used to access the HotSpotCollection for the ImageMap control and add the CircleHotSpot objects to it. For this example to work correctly, you must supply your own image for the ImageUrl property and update the path to the image appropriately so that the application can locate it.

<%@ page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">
  void Page_Load (Object sender, EventArgs e)
    // Programmatically create an ImageMap control.
    ImageMap Shop = new ImageMap();
    // Set properties on the ImageMap control.
    Shop.ImageUrl = "Images/ShopChoice.jpg";
    Shop.AlternateText = "Shopping choices";

    // Add the ImageMap control to the 
    // Controls collection of the page.

    // Programmatically create a CircleHotSpot object.
    CircleHotSpot Circle1 = new CircleHotSpot();
    Circle1.HotSpotMode = HotSpotMode.Navigate;
    Circle1.NavigateUrl = "";
    Circle1.X = 145;
    Circle1.Y = 120;
    Circle1.Radius = 75;
    Circle1.AlternateText = "Shop for toys";

    // Add Circle1 to the ImageMap's HotSpotCollection.    

    // Programmatically create a second CircleHotSpot object.
    CircleHotSpot Circle2 = new CircleHotSpot();
    Circle2.HotSpotMode = HotSpotMode.Navigate;
    Circle2.NavigateUrl = "";
    Circle2.X = 145;
    Circle2.Y = 290;
    Circle2.Radius = 75;
    Circle2.AlternateText = "Shop for wine";

    // Add Circle2 to the ImageMap's HotSpotCollection.    


<html xmlns="" >
<head id="head1" runat="server">
  <title>ImageMap Class C# Constructor Example</title>
    <form id="form1" runat="server">
      <h3>ImageMap Class C# Constructor Example</h3>
      <h4>Shopping Choices:</h4>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0