RectangleHotSpot.GetCoordinates メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > RectangleHotSpot.GetCoordinates メソッドの意味・解説 

RectangleHotSpot.GetCoordinates メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

RectangleHotSpot オブジェクト左上隅の x 座標y 座標、および右下隅の x 座標y 座標を表す文字列を返します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Overrides Function
 GetCoordinates As String
Dim instance As RectangleHotSpot
Dim returnValue As String

returnValue = instance.GetCoordinates
public override string GetCoordinates ()
public:
virtual String^ GetCoordinates () override
public String GetCoordinates ()

戻り値
RectangleHotSpot オブジェクト左上隅の x 座標y 座標、および右下隅の x 座標y 座標を表す文字列。

解説解説
使用例使用例

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>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

RectangleHotSpot.GetCoordinates メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RectangleHotSpot.GetCoordinates メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS