다음을 통해 공유


CircleHotSpot.GetCoordinates 메서드

정의

CircleHotSpot 개체 중심의 XY 좌표와 개체 반지름의 길이를 나타내는 문자열을 반환합니다.

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

반환

String

CircleHotSpot 개체 중심의 XY 좌표와 개체 반지름의 길이를 나타내는 문자열을 반환합니다.

예제

다음 코드 예제에 선언적으로 만드는 방법을 보여 줍니다는 ImageMap 컨트롤 두 개가 포함 된 CircleHotSpot 개체입니다. 사용자 중 하나를 클릭할 때 합니다 CircleHotSpot 개체는 GetCoordinates 메서드 좌표를 반환 하 고 사용자에 게 표시 합니다. 이 예제가 제대로 작동 하려면 사용자 고유의 이미지를 제공 해야 합니다는 ImageUrl 속성 경로 업데이트 된 이미지를 적절 하 게 애플리케이션에서 찾을 수 있도록 합니다.

<%@ 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 ShopMap_Clicked(object sender, ImageMapEventArgs e)
  {    
    string coordinates;
    
    // When a user clicks the Circle1 hot spot,
    // display the hot spot's coordinates.
    //if (e.Value == "Circle1")
    if (e.PostBackValue.ToString() == "Circle1")
    {
      coordinates = Shop.HotSpots[0].GetCoordinates();
      Message1.Text = "The hot spot's coordinates are " + coordinates + ".";
    }
      
    // When a user clicks the Circle2 hot spot,
    // display the hot spot's coordinates.
    //else if (e.Value == "Circle2")
    else if (e.PostBackValue.ToString() == "Circle2")
    {
      coordinates = Shop.HotSpots[1].GetCoordinates ();
      Message1.Text = "The hot spot's coordinates are " + coordinates + ".";
    }
    else
      Message1.Text = "You did not click a valid hot spot region.";        
  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
  <title>CircleHotSpot.GetCoordinates Example</title>
</head>
  <body>
    <form id="form1" runat="server">
    
      <h3>CircleHotSpot.GetCoordinates Example</h3>
      
      <h4>Shopping Choices:</h4>
      
      <asp:imagemap id="Shop"           
        imageurl="Images/ShopChoice.jpg" 
        width="150"
        height="360" 
        onclick="ShopMap_Clicked"
        alternatetext="Shopping choices"
        runat="Server">    
        
        <asp:circlehotspot
          postbackvalue="Circle1"
          x="75"
          y="120"
          radius="75"
          hotspotmode="PostBack"
          alternatetext="Shop for toys.">           
        </asp:circlehotspot> 
        
        <asp:circlehotspot
          postbackvalue="Circle2"
          x="75"
          y="290"
          radius="75"
          hotspotmode="PostBack"
          alternatetext="Shop for wine.">           
        </asp:circlehotspot>     
          
      </asp:imagemap>          
      
      <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 ShopMap_Clicked(ByVal sender As Object, ByVal e As ImageMapEventArgs)
    
    Dim coordinates As String
    
    ' When a user clicks the Circle1 hot spot,
    ' display the hot spot's coordinates.
    If (e.PostBackValue.ToString() = "Circle1") Then
      coordinates = Shop.HotSpots(0).GetCoordinates()
      Message1.Text = "The hot spot's coordinates are " & coordinates & "."
                     
      ' When a user clicks the Circle2 hot spot,
      ' display the hot spot's coordinates.
    ElseIf (e.PostBackValue.ToString() = "Circle2") Then
      coordinates = Shop.HotSpots(1).GetCoordinates()
      Message1.Text = "The hot spot's coordinates are " & coordinates & "."
      
    Else
      Message1.Text = "You did not click a valid hot spot region."
                
    End If
        
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
  <title>CircleHotSpot.GetCoordinates Example</title>
</head>
  <body>
    <form id="form1" runat="server">
    
      <h3>CircleHotSpot.GetCoordinates Example</h3>
      
      <h4>Shopping Choices:</h4>
      
      <asp:imagemap id="Shop"           
        imageurl="Images/ShopChoice.jpg"
        width = "150"
        height = "360"
        onclick="ShopMap_Clicked"
        alternatetext="Shopping choices"
        runat="Server">    
        
        <asp:circlehotspot
          postbackvalue="Circle1"
          x="75"
          y="120"
          radius="75"
          hotspotmode="PostBack"
          alternatetext="Shop for toys.">           
        </asp:circlehotspot> 
        
        <asp:circlehotspot
          postbackvalue="Circle2"
          x="75"
          y="290"
          radius="75"
          hotspotmode="PostBack"
          alternatetext="Shop for wine.">           
        </asp:circlehotspot>     
          
      </asp:imagemap>          
      
      <br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>             
                 
    </form>      
  </body>
</html>

설명

이 메서드는 할당 된 값을 사용 합니다 XY 중심 좌표 및 할당 된 값을 반환할 속성은 Radius 반지름 반환할 속성입니다.

합니다 GetCoordinates 메서드는 내부적으로 ASP.NET에서의 좌표에 사용할 텍스트를 CircleHotSpot 렌더링 되는 경우.

적용 대상

추가 정보