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

PolygonHotSpot クラス

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

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

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

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

このクラスは、ImageMap コントロールに多角形のホット スポット領域を定義します。PolygonHotSpot は、不規則な形状のホットスポット領域を ImageMap コントロールに定義する場合に便利です。たとえば、地図の中に個別の領域を定義するために使用できます。

PolygonHotSpot の領域を定義するには、PolygonHotSpot オブジェクトの各頂点の座標を指定する文字列を Coordinates プロパティに設定します。多角形の頂点とは、多角形の 2 辺が交わる点です。

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

使用例使用例

3 つの PolygonHotSpot オブジェクトを持つ ImageMap コントロールを作成する方法を次のコード例に示します。各 PolygonHotSpot オブジェクトは、地図上の地理的な領域を表します。ユーザーが PolygonHotSpot オブジェクトをクリックすると、サーバーへのポストバックが行われ、ホット スポットの種類と名前がラベルに表示されます。

<%@ Page Language="VB" %>

<script runat="server">
  
  Sub RegionMap_Clicked(ByVal sender As
 Object, ByVal e As ImageMapEventArgs)
    Dim hotSpotType As String
        
    ' When a user clicks a hot spot, display
    ' the hot spot's type and name.
    Select Case (e.PostBackValue)
      
      Case ("Western")
        hotSpotType = Regions.HotSpots(0).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case ("Northern")
        hotSpotType = Regions.HotSpots(1).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case ("Southern")
        hotSpotType = Regions.HotSpots(2).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case Else
        Message1.Text = "You did not click a valid hot spot region."
    
    End Select

  End Sub
  
</script>

<html>
<head id="Head1" runat="server">
  <title>PolygonHotSpot Class Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot Example</h3>
      
      <!-- Change or remove the width and
 height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Regions"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales Regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"
         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"
         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
        
        <asp:PolygonHotSpot 
          coordinates="128,185,335,157,400,224,400,400,228,400"
         
          postbackvalue="Southern"
          alternatetext="Southern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>
<%@ Page Language="C#" %>

<script runat="server">
  
  void RegionMap_Clicked (object sender, ImageMapEventArgs e)
  {
    string hotSpotType;

    // When a user clicks a hot spot, display
    // the hot spot's type and name.
    switch (e.PostBackValue)
    {
      case "Western":
        hotSpotType = Regions.HotSpots[0].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;
        
      case "Northern":
        hotSpotType = Regions.HotSpots[1].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;

      case "Southern":
        hotSpotType = Regions.HotSpots[2].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;

      default:
        Message1.Text = "You did not click a valid hot spot region.";
        break;
    }
  }  
  
</script>

<html>
<head id="Head1" runat="server">
  <title>PolygonHotSpot Class Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot Example</h3>
      
      <!-- Change or remove the width and height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Regions"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales Regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
        
        <asp:PolygonHotSpot 
          coordinates="128,185,335,157,400,224,400,400,228,400"       
  
          postbackvalue="Southern"
          alternatetext="Southern Region">
        </asp:PolygonHotSpot>
      
      </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.PolygonHotSpot
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

PolygonHotSpot コンストラクタ

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

PolygonHotSpot クラスの新しいインスタンスを初期化します。

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

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

プログラムによって PolygonHotSpot オブジェクトを作成し、ImageMap コントロールに追加する方法を次のコード例に示します。ImageMap コントロールには、宣言によって追加された別の 2 つの PolygonHotSpot オブジェクトが含まれます。各 PolygonHotSpot オブジェクトは、地図上の地理的な領域を表します。ユーザーが PolygonHotSpot オブジェクトをクリックすると、サーバーへのポストバックが行われ、ホット スポットの種類と名前がラベルに表示されます。

<%@ Page Language="VB" %>

<script runat="server">
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
    ' Programmatically create a PolygonHotSpot.
    Dim Polygon1 As New
 PolygonHotSpot
    Polygon1.Coordinates = "128,185,335,157,400,224,400,400,228
,400"
    Polygon1.PostBackValue = "Southern"
    Polygon1.AlternateText = "Southern Region"
    
    ' Add it to the end of the ImageMap control's
    ' HotSpotCollection.
    Regions.HotSpots.Add(Polygon1)
  End Sub
  
  Sub RegionMap_Clicked(ByVal sender As
 Object, ByVal e As ImageMapEventArgs)
    Dim hotSpotType As String
        
    ' When a user clicks a hot spot, display
    ' the hot spot's type and name.
    Select Case (e.PostBackValue)
      
      Case ("Western")
        hotSpotType = Regions.HotSpots(0).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case ("Northern")
        hotSpotType = Regions.HotSpots(1).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case ("Southern")
        hotSpotType = Regions.HotSpots(2).ToString()
        Message1.Text = "You selected " & hotSpotType
 & " " & e.PostBackValue
      
      Case Else
        Message1.Text = "You did not click a valid hot spot region."
    
    End Select
  End Sub
  
</script>

<html>
<head id="Head1" runat="server">
  <title>PolygonHotSpot Constructor Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot Constructor Example</h3>
      
      <!-- Change or remove the width and
 height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Regions"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales Regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"
         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"
         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><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 PolygonHotSpot.
    PolygonHotSpot Polygon1 = new PolygonHotSpot();
    Polygon1.Coordinates = "128,185,335,157,400,224,400,400,228,400";
    Polygon1.PostBackValue = "Southern";
    Polygon1.AlternateText = "Southern Region";
    
    // Add it to the end of the ImageMap control's
    // HotSpotCollection.
    Regions.HotSpots.Add(Polygon1);
  }
  
  void RegionMap_Clicked (object sender, ImageMapEventArgs e)
  {
    string hotSpotType;

    // When a user clicks a hot spot, display
    // the hot spot's type and name.
    switch (e.PostBackValue)
    {
      case "Western":
        hotSpotType = Regions.HotSpots[0].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;
        
      case "Northern":
        hotSpotType = Regions.HotSpots[1].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;

      case "Southern":
        hotSpotType = Regions.HotSpots[2].ToString();
        Message1.Text = "You selected " + hotSpotType + " " +
 e.PostBackValue;
        break;

      default:
        Message1.Text = "You did not click a valid hot spot region.";
        break;
    }
  }  
  
</script>

<html>
<head id="Head1" runat="server">
  <title>PolygonHotSpot Constructor Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
    
      <h3>PolygonHotSpot Constructor Example</h3>
      
      <!-- Change or remove the width and height attributes as
           appropriate for your image. -->
      <asp:imagemap id="Regions"           
        imageurl="Images/RegionMap.jpg"
        alternatetext="Sales Regions" 
        hotspotmode="PostBack"
        width="400"
        height="400"
        onclick="RegionMap_Clicked"   
        runat="Server">            
          
        <asp:PolygonHotSpot 
          coordinates="0,0,176,0,125,182,227,400,0,400"         
          postbackvalue="Western"
          alternatetext="Western Region">
        </asp:PolygonHotSpot>
          
        <asp:PolygonHotSpot 
          coordinates="177,0,400,0,400,223,335,154,127,180"         
          postbackvalue="Northern"
          alternatetext="Northern Region">
        </asp:PolygonHotSpot>
      
      </asp:imagemap>
            
      <br /><br />
          
      <asp:label id="Message1"
        runat="Server">
      </asp:label>                 
                 
    </form>      
  </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

PolygonHotSpot プロパティ


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

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

関連項目

PolygonHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
Coordinates

その他の技術情報

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

PolygonHotSpot メソッド


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

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

関連項目

PolygonHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
Coordinates

その他の技術情報

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

PolygonHotSpot メンバ

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

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


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

関連項目

PolygonHotSpot クラス
System.Web.UI.WebControls 名前空間
ImageMap クラス
Coordinates

その他の技術情報

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



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「PolygonHotSpot」の関連用語

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

   

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



PolygonHotSpotのページの著作権

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

©2026 GRAS Group, Inc.RSS