RectangleHotSpot.GetCoordinates メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As RectangleHotSpot Dim returnValue As String returnValue = instance.GetCoordinates
RectangleHotSpot オブジェクトの左上隅の x 座標と y 座標、および右下隅の x 座標と y 座標を表す文字列。

このメソッドは、RectangleHotSpot オブジェクトの左上隅の座標と右下隅の座標を表す文字列を返します。このメソッドは、Left プロパティと Top プロパティに指定された値を使用して、左上隅の座標を返します。Right プロパティと Bottom プロパティに指定された値を使用して、右上隅の座標を返します。
GetCoordinates メソッドは、RectangleHotSpot をレンダリングする際に、その座標に使用するテキストを取得するために、ASP.NET によって内部的に使用されます。返される文字列は、ブラウザやマークアップ言語に固有です。

2 つの RectangleHotSpot オブジェクトを含む ImageMap コントロールを、宣言によって作成する方法を次のコード例に示します。ImageMap.HotSpotMode プロパティは HotSpotMode.PostBack に設定されます。この場合、ユーザーがいずれかのホット スポット領域をクリックするたびに、ページがサーバーにポストバックされます。ユーザーがいずれかの RectangleHotSpot オブジェクトをクリックするたびに、GetCoordinates メソッドが呼び出され、選択されたホット スポットの座標がユーザーに表示されます。この例を正常に動作させるには、ImageUrl プロパティにユーザー独自のイメージを提供し、アプリケーションがそのイメージを見つけられるように、イメージへのパスを適切に更新する必要があります。
<%@ Page Language="VB" %> <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> <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>
<%@ page language="C#" %> <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> <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>

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRectangleHotSpot.GetCoordinates メソッドを検索する場合は、下記のリンクをクリックしてください。

- RectangleHotSpot.GetCoordinates メソッドのページへのリンク