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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「PolygonHotSpot クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS