PolygonHotSpot.GetCoordinates 메서드

정의

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

public:
 override System::String ^ GetCoordinates();
public override string GetCoordinates ();
override this.GetCoordinates : unit -> string
Public Overrides Function GetCoordinates () As String

반환

String

PolygonHotSpot 개체의 꼭짓점에 대한 좌표를 나타내는 좌표의 문자열입니다. 기본값은 빈 문자열("")입니다.

예제

다음 코드 예제에서는 만드는 방법을 보여 줍니다.는 ImageMap 세 가지를 포함 하는 컨트롤 PolygonHotSpot 개체입니다. 각 PolygonHotSpot 개체 지도에서 지리적 영역을 나타냅니다. 클릭할 때를 PolygonHotSpot 개체를 서버로 다시 게시 합니다. GetCoordinates 레이블에 표시할 수 있도록 메서드 다각형의 꼭 짓 점 좌표를 검색 합니다.

<%@ 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 RegionMap_Clicked (object sender, ImageMapEventArgs e)
  {
    string coordinates;

    // When a user clicks a hot spot, display
    // the hot spot's type and name.
    switch (e.PostBackValue)
    {
      case "Western":
        coordinates = Regions.HotSpots[0].GetCoordinates();
        Message1.Text = "The coordinates are " + coordinates;
        break;
        
      case "Northern":
        coordinates = Regions.HotSpots[1].GetCoordinates();
        Message1.Text = "The coordinates are " + coordinates;
        break;

      case "Southern":
        coordinates = Regions.HotSpots[2].GetCoordinates();
        Message1.Text = "The coordinates are " + coordinates;
        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.GetCoordinates Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot.GetCoordinates 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:PolygonHotSpot 
          coordinates="128,185,335,157,400,224,400,400,228,400"         
          postbackvalue="Southern"
          alternatetext="Southern 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 RegionMap_Clicked(ByVal sender As Object, ByVal e As ImageMapEventArgs)
    Dim coordinates As String
        
    ' When a user clicks a hot spot, display
    ' the coordinates of the hot spot's vertices.
    Select Case (e.PostBackValue)
      
      Case ("Western")
        coordinates = Regions.HotSpots(0).GetCoordinates()
        Message1.Text = "The coordinates are " & coordinates
      
      Case ("Northern")
        coordinates = Regions.HotSpots(1).GetCoordinates()
        Message1.Text = "The coordinates are " & coordinates
      
      Case ("Southern")
        coordinates = Regions.HotSpots(2).GetCoordinates()
        Message1.Text = "The coordinates are " & coordinates
      
      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.GetCoordinates Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot.GetCoordinates 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:PolygonHotSpot 
          coordinates="128,185,335,157,400,224,400,400,228,400"         
          postbackvalue="Southern"
          alternatetext="Southern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>

설명

합니다 GetCoordinates 의 꼭 짓 점 좌표를 나타내는 문자열을 반환 하는 메서드를 PolygonHotSpot 개체입니다. 이 메서드가 반환 하는 문자열의 현재 값인는 Coordinates 속성입니다.

합니다 GetCoordinates 메서드는 내부적으로 ASP.NET에서의 좌표에 사용할 텍스트를 PolygonHotSpot 렌더링 되는 경우. 문자열 반환 되는 브라우저와 태그 언어와 관련이 있습니다.

적용 대상

추가 정보