This documentation is archived and is not being maintained.

PolygonHotSpot.Coordinates Property

Note: This property is new in the .NET Framework version 2.0.

A string of coordinates that represents the vertexes of a PolygonHotSpot object.

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

public string Coordinates { get; set; }
/** @property */
public String get_Coordinates ()

/** @property */
public void set_Coordinates (String value)

public function get Coordinates () : String

public function set Coordinates (value : String)

Property Value

A string that represents the coordinates of a PolygonHotSpot object's vertexes.

Use the Coordinates property to specify the coordinates of the vertexes of a PolygonHotSpot object. A polygon vertex is a point at which two polygon edges meet. The string that you specify must be formatted with each coordinate separated by a comma. Each vertex that you specify must have both an x- coordinate and a y-coordinate. For example, the string "128,185,335,157,510,224,510,383,228,383" defines a polygon hot spot with five vertexes. The x-coordinate of the first vertex is 128. The y-coordinate of the first vertex is 185.

The following code example demonstrates how to programmatically create a PolygonHotSpot object and add it to an ImageMap control. The Coordinates property is used to specify the coordinates of the vertexes of the PolygonHotSpot object. The ImageMap control contains two other PolygonHotSpot objects that have been added declaratively. Each PolygonHotSpot object represents a geographical region on the map. When the user clicks a PolygonHotSpot object, it posts back to the server and the type and name of the hot spot are displayed in a label.

<%@ Page Language="C#" %>

<script runat="server">
  void Page_Load(object sender, EventArgs e)
    // Programmatically create a PolygonHotSpot.
    PolygonHotSpot Polygon1 = new PolygonHotSpot();
    Polygon1.Coordinates = "128,185,335,157,400,224,400,400,228,400";
    Polygon1.PostBackValue = "Southern";
    Polygon1.AlternateText = "Southern Region";
    // Add it to the end of the ImageMap control's
    // HotSpotCollection.
  void RegionMap_Clicked (object sender, ImageMapEventArgs e)
    string hotSpotType;

    // When a user clicks a hot spot, display
    // the hot spot's type and name.
    switch (e.PostBackValue)
      case "Western":
        hotSpotType = Regions.HotSpots[0].ToString();
        Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue;
      case "Northern":
        hotSpotType = Regions.HotSpots[1].ToString();
        Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue;

      case "Southern":
        hotSpotType = Regions.HotSpots[2].ToString();
        Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue;

        Message1.Text = "You did not click a valid hot spot region.";

<head id="Head1" runat="server">
  <title>PolygonHotSpot Constructor Example</title>
    <form id="Form1" runat="server">
      <h3>PolygonHotSpot Constructor Example</h3>
      <!-- Change or remove the width and height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Regions"           
        alternatetext="Sales Regions" 
          alternatetext="Western Region">
          alternatetext="Northern Region">
      <br /><br />
      <asp:label id="Message1"

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0