PolygonHotSpot.Coordinates 속성

정의

PolygonHotSpot 개체의 꼭짓점을 나타내는 좌표의 문자열입니다.

public:
 property System::String ^ Coordinates { System::String ^ get(); void set(System::String ^ value); };
public string Coordinates { get; set; }
member this.Coordinates : string with get, set
Public Property Coordinates As String

속성 값

String

PolygonHotSpot 개체의 꼭짓점에 대한 좌표를 나타내는 문자열입니다.

예제

다음 코드 예제에는 프로그래밍 방식으로 만드는 방법을 보여 줍니다는 PolygonHotSpot 개체에 추가 하는 ImageMap 제어 합니다. 합니다 Coordinates 속성의 꼭 짓 점 좌표를 지정 하는을 사용 하는 PolygonHotSpot 개체입니다. 합니다 ImageMap 컨트롤에는 두 개의 다른 PolygonHotSpot 선언적으로 추가 된 개체입니다. 각 PolygonHotSpot 개체 지도에서 지리적 영역을 나타냅니다. 클릭할 때를 PolygonHotSpot 개체를 서버에 다시 게시 하 고 핫 스폿을의 이름과 유형을 레이블에 표시 됩니다.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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.
    Regions.HotSpots.Add(Polygon1);
  }
  
  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;
        break;
        
      case "Northern":
        hotSpotType = Regions.HotSpots[1].ToString();
        Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue;
        break;

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

      default:
        Message1.Text = "You did not click a valid hot spot region.";
        break;
    }
  }  
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
  <title>PolygonHotSpot Constructor Example</title>
</head>
  <body>
    <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"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  
  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    ' Programmatically create a PolygonHotSpot.
    Dim Polygon1 As 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.
    Regions.HotSpots.Add(Polygon1)
  End Sub
  
  Sub RegionMap_Clicked(ByVal sender As Object, ByVal e As ImageMapEventArgs)
    Dim hotSpotType As String
        
    ' When a user clicks a hot spot, display
    ' the hot spot's type and name.
    Select Case (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
      
      Case Else
        Message1.Text = "You did not click a valid hot spot region."
    
    End Select
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
  <title>PolygonHotSpot Constructor Example</title>
</head>
  <body>
    <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"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>

설명

사용 된 Coordinates 의 꼭 짓 점 좌표를 지정 하는 속성을 PolygonHotSpot 개체입니다. 다각형의 꼭지점에 두 개의 다각형 가장자리 충족 하는 지점입니다. 쉼표로 구분 된 각 좌표를 사용 하 여 지정 된 문자열을 포맷 되어야 합니다. 지정 된 각 꼭 짓 점 x-좌표와 y 좌표에 있어야 합니다. 예를 들어 문자열 "128185335157510224510383228383" 5 개의 꼭 짓 점에 대 한 다각형 핫 스폿을 정의합니다. 첫 번째 꼭 짓 점의 x-좌표는 128 개입니다. 첫 번째 꼭 짓 점의 y-좌표는 185입니다.

적용 대상

추가 정보