RectangleHotSpotとは? わかりやすく解説

RectangleHotSpot クラス

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

ImageMap コントロール四角形ホット スポット領域定義します。このクラス継承できません。

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

Public NotInheritable Class
 RectangleHotSpot
    Inherits HotSpot
Dim instance As RectangleHotSpot
public sealed class RectangleHotSpot : HotSpot
public ref class RectangleHotSpot sealed :
 public HotSpot
public final class RectangleHotSpot extends
 HotSpot
public final class RectangleHotSpot extends
 HotSpot
解説解説

このクラスは、ImageMap コントロール四角形ホット スポット領域定義しますRectangleHotSpot オブジェクト領域定義するには、その四角形領域左上隅の x 座標を表す値を Left プロパティ設定しますTop プロパティには、四角形領域左上隅の y 座標を表す値を設定しますRight プロパティには、四角形領域右下隅の x 座標を表す値を設定しますBottom プロパティには、四角形領域右下隅の y 座標を表す値を設定します

RectangleHotSpot コントロールクリックすると、URL へのページ移動サーバーへのポストバック生成が行われるか、または何も起こりません。この動作は、HotSpotMode プロパティ指定しますURL移動するには、HotSpotMode プロパティHotSpotMode.Navigate設定し、NavigateUrl プロパティ使用して移動先の URL指定しますサーバーへのポストバックを行うには、HotSpotMode プロパティHotSpotMode.PostBack設定し、PostBackValue プロパティ使用してRectangleHotSpot オブジェクトの名前を指定します。この名前は、RectangleHotSpotクリックされたときに、ImageMapEventArgs イベント データ渡されます。. HotSpot オブジェクトが何も動作行わないようにするには、HotSpotMode プロパティHotSpotMode.Inactive設定します

使用例使用例

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
    Dim hotSpotType As String
    Dim yescount As Integer
    Dim nocount As Integer
    
    If (ViewState("yescount") IsNot
 Nothing) Then
      yescount = Convert.ToInt32(ViewState("yescount"))
    Else
      yescount = 0
    End If
    If (ViewState("nocount") IsNot
 Nothing) Then
      nocount = Convert.ToInt32(ViewState("nocount"))
    Else
      nocount = 0
    End If
      
    
    ' When a user clicks the "Yes" hot spot,
    ' display the hot spot's name and coordinates.
    If (e.PostBackValue.Contains("Yes"))
 Then
      
      yescount += 1
      coordinates = Vote.HotSpots(0).GetCoordinates()
      hotSpotType = Vote.HotSpots(0).ToString()
      Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue & ".<br>"
 & _
                      "The coordinates are " &
 coordinates & ".<br>" & _
                      "The current vote count is "
 & yescount.ToString() & _
                      " yes votes and " & nocount.ToString()
 & " no votes."
       
      ' When a user clicks the "No" hot spot,
      ' display the hot spot's name and coordinates.
    ElseIf (e.PostBackValue.Contains("No"))
 Then
      
      nocount += 1
      coordinates = Vote.HotSpots.Item(1).GetCoordinates()
      hotSpotType = Vote.HotSpots.Item(1).ToString()
      Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue & ".<br>"
 & _
                     "The coordinates are " &
 coordinates & ".<br>" & _
                      "The current vote count is "
 & yescount.ToString() & _
                      " yes votes and " & nocount.ToString()
 & " no votes."
      
    Else
      
      Message1.Text = "You did not click a valid hot spot region."
                
    End If
      
    ViewState("yescount") = yescount
    ViewState("nocount") = nocount
    
  End Sub
  
</script>

<html>
<head id="Head1" runat="server">
  <title>ImageMap Class Post Back Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>ImageMap Class Post Back Example</h3>
      
      <asp:imagemap id="Vote"           
        imageurl="Images/VoteImage.jpg"
        width="400" 
        height="200" 
        alternatetext="Vote Yes or No"
        hotspotmode="PostBack"
        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;
    string hotSpotType;
    int yescount = ((ViewState["yescount"] != null)?
 (int)ViewState["yescount"] : 0);
    int nocount = ((ViewState["nocount"] != null)?
 (int)ViewState["nocount"] : 0);

    // When a user clicks the "Yes" hot spot,
    // display the hot spot's name and coordinates.
    if (e.PostBackValue.Contains("Yes"))
    {
      yescount += 1;
      coordinates = Vote.HotSpots[0].GetCoordinates();
      hotSpotType = Vote.HotSpots[0].ToString ();
      Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue
 + ".<br>" +
                      "The coordinates are " + coordinates + ".<br>"
 +
                      "The current vote count is " + yescount.ToString()
 + 
            " yes votes and " + nocount.ToString() + " no votes.";
    }
      
    // When a user clicks the "No" hot spot,
    // display the hot spot's name and coordinates.
    else if (e.PostBackValue.Contains("No"))
    {
      nocount += 1;
      coordinates = Vote.HotSpots[1].GetCoordinates();
      hotSpotType = Vote.HotSpots[1].ToString ();
      Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue
 + ".<br>" +
                      "The coordinates are " + coordinates + ".<br>"
 +
            "The current vote count is " + yescount.ToString() +
            " yes votes and " + nocount.ToString() + " no votes.";
    }
    
    else
    {
      Message1.Text = "You did not click a valid hot spot region.";
    }

    ViewState["yescount"] = yescount;
    ViewState["nocount"] = nocount;
  }           
  
</script>

<html>
<head id="Head1" runat="server">
  <title>ImageMap Class Post Back Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>ImageMap Class Post Back Example</h3>
      
      <asp:imagemap id="Vote"           
        imageurl="Images/VoteImage.jpg"
        width="400" 
        height="200" 
        alternatetext="Vote Yes or No"
        hotspotmode="PostBack"
        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>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.WebControls.HotSpot
    System.Web.UI.WebControls.RectangleHotSpot
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RectangleHotSpot コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

RectangleHotSpot クラス新しインスタンス初期化します。

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

Dim instance As New RectangleHotSpot
public RectangleHotSpot ()
public:
RectangleHotSpot ()
public RectangleHotSpot ()
public function RectangleHotSpot ()
解説解説
使用例使用例

プログラム使用して 2 つRectangleHotSpot オブジェクト作成し、それらのプロパティ設定しImageMap コントロールの HotSpotCollection コレクション追加する方法次のコード例示します。この例を正常に動作させるには、ImageUrl プロパティユーザー独自のイメージ提供しアプリケーションがそのイメージを見つけられるように、イメージへのパス適切に更新する必要があります

<%@ page language="VB" %>

<script runat="server">
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

    ' Programmatically create a RectangleHotSpot.
    Dim Rectangle1 As New
 RectangleHotSpot
    Rectangle1.Top = 0
    Rectangle1.Left = 0
    Rectangle1.Bottom = 200
    Rectangle1.Right = 200
    Rectangle1.PostBackValue = "Yes"
    Rectangle1.AlternateText = "Vote yes"
      
    ' Programmatically create a second RectangleHotSpot.
    Dim Rectangle2 As New
 RectangleHotSpot
    Rectangle2.Top = 0
    Rectangle2.Left = 201
    Rectangle2.Bottom = 200
    Rectangle2.Right = 400
    Rectangle2.PostBackValue = "No"
    Rectangle2.AlternateText = "Vote no"

    
    ' Add the RectangleHotSpot objects to the
    ' Vote ImageMap control's HotSpotCollection.
    Vote.HotSpots.Add(Rectangle1)
    Vote.HotSpots.Add(Rectangle2)
  
  End Sub
    
  Sub VoteMap_Clicked(ByVal sender As
 Object, ByVal e As ImageMapEventArgs)
    Dim hotSpotType As String
        
    ' When a user clicks the "Yes" hot spot,
    ' display the hot spot's name.
    If (e.PostBackValue = "Yes")
 Then
      hotSpotType = Vote.HotSpots(0).ToString()
      Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue & "."
       
      ' When a user clicks the "No" hot spot,
      ' display the hot spot's name.
    ElseIf (e.PostBackValue = "No")
 Then
      hotSpotType = Vote.HotSpots(1).ToString()
      Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue & "."
      
    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 VB Constructor Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>RectangleHotSpot Constructor Example</h3>
      
      <!-- Change or remove the width and
 height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Vote"           
        imageurl="Images/VoteImage.jpg"
        alternatetext="Vote choices" 
        hotspotmode="PostBack"
        width="400"
        height="200"
        onclick="VoteMap_Clicked"   
        runat="Server">
      </asp:imagemap>
      
      <br />
                
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>
<%@ page language="C#" %>

<script runat="server">
  void Page_Load(object sender, EventArgs e)
  {
    // Programmatically create a RectangleHotSpot.
    RectangleHotSpot Rectangle1 = new RectangleHotSpot();
    Rectangle1.Top = 0;
    Rectangle1.Left = 0;
    Rectangle1.Bottom = 200;
    Rectangle1.Right = 200;
    Rectangle1.PostBackValue = "Yes";
    Rectangle1.AlternateText = "Vote yes";
      
    // Programmatically create a second RectangleHotSpot.
    RectangleHotSpot Rectangle2 = new RectangleHotSpot();
    Rectangle2.Top = 0;
    Rectangle2.Left = 201;
    Rectangle2.Bottom = 200;
    Rectangle2.Right = 400;
    Rectangle2.PostBackValue = "No";
    Rectangle2.AlternateText = "Vote no";
    
    // Add the RectangleHotSpot objects to the
    // Vote ImageMap control's HotSpotCollection.
    Vote.HotSpots.Add(Rectangle1);
    Vote.HotSpots.Add(Rectangle2);  
  }
  
  void VoteMap_Clicked (Object sender, ImageMapEventArgs e)
  {
    string hotSpotType;

    // When a user clicks the "Yes" hot spot,
    // display the hot spot's name.
    if (e.PostBackValue == "Yes")
    {
      hotSpotType = Vote.HotSpots[0].ToString ();
      Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue
 + "."; 
    }
      
    // When a user clicks the "No" hot spot,
    // display the hot spot's name.
    else if (e.PostBackValue == "No")
    {
      hotSpotType = Vote.HotSpots[1].ToString ();
      Message1.Text = "You selected " + hotSpotType + " " + e.PostBackValue
 + ".";
    }
    
    else
    {
      Message1.Text = "You did not click a valid hot spot region.";
    }
  }  

</script>

<html>
<head id="Head1" runat="server">
  <title>RectangleHotSpot C# Constructor Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>RectangleHotSpot Constructor Example</h3>
      
      <!-- Change or remove the width and height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Vote"           
        imageurl="Images/VoteImage.jpg"
        alternatetext="Vote choices" 
        hotspotmode="PostBack"
        width="400"
        height="200"
        onclick="VoteMap_Clicked"   
        runat="Server">
      </asp:imagemap>
      
      <br />
                
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RectangleHotSpot プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ AccessKey  HotSpot 領域すばやく移動できるアクセス キー取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ AlternateText  イメージ使用できない場合や、イメージサポートしないブラウザイメージ表示される場合に、ImageMap コントロールHotSpot オブジェクト表示する代替テキスト取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ Bottom RectangleHotSpot オブジェクト定義される四角形領域下辺y 座標取得または設定します
パブリック プロパティ HotSpotMode  HotSpotクリックされたときの、ImageMap コントロールHotSpot オブジェクト動作取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ Left RectangleHotSpot オブジェクト定義される四角形領域左辺x 座標取得または設定します
パブリック プロパティ NavigateUrl  HotSpot オブジェクトクリックされたときの移動URL取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ PostBackValue  HotSpotクリックされたときにイベント データ渡される HotSpot オブジェクトの名前を取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ Right RectangleHotSpot オブジェクト定義される四角形領域右辺x 座標取得または設定します
パブリック プロパティ TabIndex  HotSpot 領域タブ インデックス取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ Target  URL移動する HotSpot オブジェクトクリックされたときに、リンク先 Web ページ内容表示するウィンドウまたはフレーム取得または設定します。 ( HotSpot から継承されます。)
パブリック プロパティ Top RectangleHotSpot オブジェクト定義される四角形領域の上辺の y 座標取得または設定します
参照参照

関連項目

RectangleHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
HotSpot.HotSpotMode プロパティ
Left
Top
Right
Bottom

その他の技術情報

ImageMap Web サーバー コントロール

RectangleHotSpot メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RectangleHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
HotSpot.HotSpotMode プロパティ
Left
Top
Right
Bottom

その他の技術情報

ImageMap Web サーバー コントロール

RectangleHotSpot メンバ

ImageMap コントロール四角形ホット スポット領域定義します。このクラス継承できません。

RectangleHotSpot データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド RectangleHotSpot RectangleHotSpot クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ AccessKey  HotSpot 領域すばやく移動できるアクセス キー取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ AlternateText  イメージ使用できない場合や、イメージサポートしないブラウザイメージ表示される場合に、ImageMap コントロールHotSpot オブジェクト表示する代替テキスト取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ Bottom RectangleHotSpot オブジェクト定義される四角形領域下辺y 座標取得または設定します
パブリック プロパティ HotSpotMode  HotSpotクリックされたときの、ImageMap コントロールHotSpot オブジェクト動作取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ Left RectangleHotSpot オブジェクト定義される四角形領域左辺x 座標取得または設定します
パブリック プロパティ NavigateUrl  HotSpot オブジェクトクリックされたときの移動URL取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ PostBackValue  HotSpotクリックされたときにイベント データ渡される HotSpot オブジェクトの名前を取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ Right RectangleHotSpot オブジェクト定義される四角形領域右辺x 座標取得または設定します
パブリック プロパティ TabIndex  HotSpot 領域タブ インデックス取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ Target  URL移動する HotSpot オブジェクトクリックされたときに、リンク先 Web ページ内容表示するウィンドウまたはフレーム取得または設定します。(HotSpot から継承されます。)
パブリック プロパティ Top RectangleHotSpot オブジェクト定義される四角形領域の上辺の y 座標取得または設定します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RectangleHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
HotSpot.HotSpotMode プロパティ
Left
Top
Right
Bottom

その他の技術情報

ImageMap Web サーバー コントロール



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

辞書ショートカット

すべての辞書の索引

「RectangleHotSpot」の関連用語

RectangleHotSpotのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS