HotSpotCollection.Item[Int32] Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene un riferimento all'oggetto HotSpot in corrispondenza dell'indice specificato nell'insieme HotSpotCollection .
public:
property System::Web::UI::WebControls::HotSpot ^ default[int] { System::Web::UI::WebControls::HotSpot ^ get(int index); };
public System.Web.UI.WebControls.HotSpot this[int index] { get; }
member this.Item(int) : System.Web.UI.WebControls.HotSpot
Default Public ReadOnly Property Item(index As Integer) As HotSpot
Parametri
- index
- Int32
Valore dell'indice ordinale che specifica la posizione dell'oggetto nell'insieme HotSpot .
Valore della proprietà
Oggetto HotSpot in corrispondenza dell'indice specificato nell'insieme HotSpotCollection .
Esempio
Nell'esempio di codice seguente viene illustrato come utilizzare la Item[] proprietà per accedere HotSpot direttamente agli oggetti contenuti nell'insieme ImageMap del HotSpotCollection controllo e visualizzare il valore della proprietà di AlternateText ogni oggetto in un'etichetta nella pagina. Per il corretto funzionamento di questo esempio, è necessario specificare la propria immagine per la ImageUrl proprietà e aggiornare il percorso dell'immagine in modo appropriato in modo che l'applicazione possa individuarla.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server" language="C#">
void Page_Load(object sender, EventArgs e)
{
// Use the indexer to access each object in the
// HotSpotCollection and display the value of
// its AlternateText property to the user.
for (int i = 0; i <= Shop.HotSpots.Count - 1; i++)
{
Label1.Text += "<br />" + Shop.HotSpots[i].AlternateText + "<br />";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>HotSpotCollection.Item Property Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>HotSpotCollection.Item Property Example</h3>
<h4>Shopping Choices:</h4>
<asp:imagemap id="Shop"
imageurl="Images/ShopChoice.jpg"
alternatetext="Shopping choices"
runat="Server">
<asp:circlehotspot
navigateurl="http://www.tailspintoys.com"
x="145"
y="120"
radius="75"
hotspotmode="Navigate"
alternatetext="Shop for toys">
</asp:circlehotspot>
<asp:circlehotspot
navigateurl="http://www.cohowinery.com"
x="145"
y="290"
radius="75"
hotspotmode="Navigate"
alternatetext="Shop for wine">
</asp:circlehotspot>
</asp:imagemap>
<asp:label id="Label1"
runat="Server">
</asp:label>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server" language="vb">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Use the Item property to access each object in the
' HotSpotCollection and display the value of
' its AlternateText property to the user.
For i As Integer = 0 To Shop.HotSpots.Count - 1
Label1.Text += "<br />" + Shop.HotSpots.Item(i).AlternateText + "<br />"
Next
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>HotSpotCollection.Item Property Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>HotSpotCollection.Item Property Example</h3>
<h4>Shopping Choices:</h4>
<asp:imagemap id="Shop"
imageurl="Images/ShopChoice.jpg"
alternatetext="Shopping choices"
runat="Server">
<asp:circlehotspot
navigateurl="http://www.tailspintoys.com"
x="145"
y="120"
radius="75"
hotspotmode="Navigate"
alternatetext="Shop for toys">
</asp:circlehotspot>
<asp:circlehotspot
navigateurl="http://www.cohowinery.com"
x="145"
y="290"
radius="75"
hotspotmode="Navigate"
alternatetext="Shop for wine">
</asp:circlehotspot>
</asp:imagemap>
<asp:label id="Label1"
runat="Server">
</asp:label>
</form>
</body>
</html>
Commenti
Utilizzare questo indicizzatore per accedere a un HotSpot oggetto nell'insieme in corrispondenza dell'indice specificato, utilizzando la notazione della matrice. L'indicizzatore consente di modificare o sostituire direttamente un HotSpot oggetto nell'insieme.