RectangleHotSpot.GetCoordinates 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
RectangleHotSpot 개체의 왼쪽 위 모퉁이와 오른쪽 아래 모퉁이에 대한 X 좌표와 Y 좌표를 나타내는 문자열을 반환합니다.
public:
override System::String ^ GetCoordinates();
public override string GetCoordinates();
override this.GetCoordinates : unit -> string
Public Overrides Function GetCoordinates () As String
반환
RectangleHotSpot 개체의 왼쪽 위 모퉁이와 오른쪽 아래 모퉁이에 대한 X 좌표와 Y 좌표를 나타내는 문자열입니다.
예제
다음 코드 예제에 선언적으로 만드는 방법을 보여 줍니다는 ImageMap 컨트롤 두 개가 포함 된 RectangleHotSpot 개체입니다. 합니다 ImageMap.HotSpotMode 속성이 HotSpotMode.PostBack
, 핫 스폿 영역 중 하나를 클릭할 때마다 사용자는 서버에 다시 게시 하는 페이지에 이르게 합니다. 때마다 사용자 중 하나를 클릭할 합니다 RectangleHotSpot 개체는 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 VoteMap_Clicked(object sender, ImageMapEventArgs e)
{
string coordinates;
// When a user clicks the "Yes" hot spot,
// display the hot spot's coordinates.
if (e.PostBackValue == "Yes")
{
coordinates = Vote.HotSpots[0].GetCoordinates();
Message1.Text = "The hot spot's coordinates are " + coordinates;
}
// When a user clicks the "No" hot spot,
// display the hot spot's coordinates.
else if (e.PostBackValue == "No")
{
coordinates = Vote.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>RectangleHotSpot.GetCoordinates Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>RectangleHotSpot.GetCoordinates Example</h3>
<!-- Change or remove the width and height attributes as
appropriate for your image. -->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
width="400"
height="200"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="0"
bottom="200"
right="200"
postbackvalue="Yes"
alternatetext="Vote yes">
</asp:RectangleHotSpot>
<asp:RectangleHotSpot
top="0"
left="201"
bottom="200"
right="400"
postbackvalue="No"
alternatetext="Vote no">
</asp:RectangleHotSpot>
</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 VoteMap_Clicked(ByVal sender As Object, ByVal e As ImageMapEventArgs)
Dim coordinates As String
' When a user clicks the "Yes" hot spot,
' display the hot spot's coordinates.
If (e.PostBackValue = "Yes") Then
coordinates = Vote.HotSpots(0).GetCoordinates()
Message1.Text = "The hot spot's coordinates are " & coordinates
' When a user clicks the "No" hot spot,
' display the hot spot's coordinates.
ElseIf (e.PostBackValue = "No") Then
coordinates = Vote.HotSpots(1).GetCoordinates()
Message1.Text = "The hot spot's coordinates are " & coordinates
Else
Message1.Text = "You did not click in a valid hot spot region."
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>RectangleHotSpot.GetCoordinates Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>RectangleHotSpot.GetCoordinates Example</h3>
<!-- Change or remove the width and height attributes as
appropriate for your image. -->
<asp:imagemap id="Vote"
imageurl="Images/VoteImage.jpg"
alternatetext="Voting choices"
hotspotmode="PostBack"
width="400"
height="200"
onclick="VoteMap_Clicked"
runat="Server">
<asp:RectangleHotSpot
top="0"
left="0"
bottom="200"
right="200"
postbackvalue="Yes"
alternatetext="Vote yes">
</asp:RectangleHotSpot>
<asp:RectangleHotSpot
top="0"
left="201"
bottom="200"
right="400"
postbackvalue="No"
alternatetext="Vote no">
</asp:RectangleHotSpot>
</asp:imagemap>
<br /><br />
<asp:label id="Message1"
runat="Server">
</asp:label>
</form>
</body>
</html>
설명
좌표를 나타내는 문자열을 반환 하는이 메서드는 RectangleHotSpot 개체의 왼쪽 위 모퉁이 아래쪽의 좌표를 오른쪽 모서리에 있는 합니다. 이 메서드는 할당 된 값을 사용 합니다 Left 고 Top 위쪽 좌표를 반환 하려면 속성 왼쪽입니다. 에 할당 된 값을 사용 합니다 Right 고 Bottom 오른쪽 모서리에 있는 아래쪽 좌표를 반환 하는 속성입니다.
합니다 GetCoordinates 메서드는 내부적으로 ASP.NET에서의 좌표에 사용할 텍스트를 RectangleHotSpot 렌더링 되는 경우. 문자열 반환 되는 브라우저와 태그 언어와 관련이 있습니다.