HotSpotCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public ref class HotSpotCollection sealed : System::Web::UI::StateManagedCollection
public sealed class HotSpotCollection : System.Web.UI.StateManagedCollection
type HotSpotCollection = class
inherit StateManagedCollection
Public NotInheritable Class HotSpotCollection
Inherits StateManagedCollection
- 繼承
範例
下列程式代碼範例示範如何以程序設計方式建立控件,並將兩CircleHotSpot個ImageMap物件加入其中。 屬性HotSpots是用來存取 控件的ImageMap集合,HotSpotCollection並將 物件加入CircleHotSpot其中。 若要讓這個範例正確運作,您必須提供 ImageUrl 屬性自己的映像,並適當地更新映像的路徑,讓應用程式可以找到它。
<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load (Object sender, EventArgs e)
{
// Programmatically create an ImageMap control.
ImageMap Shop = new ImageMap();
// Set properties on the ImageMap control.
Shop.ImageUrl = "Images/ShopChoice.jpg";
Shop.AlternateText = "Shopping choices";
// Add the ImageMap control to the
// Controls collection of the page.
Page.Controls.Add(Shop);
// Programmatically create a CircleHotSpot object.
CircleHotSpot Circle1 = new CircleHotSpot();
Circle1.HotSpotMode = HotSpotMode.Navigate;
Circle1.NavigateUrl = "http://www.tailspintoys.com";
Circle1.X = 145;
Circle1.Y = 120;
Circle1.Radius = 75;
Circle1.AlternateText = "Shop for toys";
// Add Circle1 to the ImageMap's HotSpotCollection.
Shop.HotSpots.Add(Circle1);
// Programmatically create a second CircleHotSpot object.
CircleHotSpot Circle2 = new CircleHotSpot();
Circle2.HotSpotMode = HotSpotMode.Navigate;
Circle2.NavigateUrl = "http://www.cohowinery.com";
Circle2.X = 145;
Circle2.Y = 290;
Circle2.Radius = 75;
Circle2.AlternateText = "Shop for wine";
// Add Circle2 to the ImageMap's HotSpotCollection.
Shop.HotSpots.Add(Circle2);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>ImageMap Class C# Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>ImageMap Class C# Constructor Example</h3>
<h4>Shopping Choices:</h4>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Programmatically create an ImageMap control.
Dim Shop As New ImageMap
Shop.ImageUrl = "Images/ShopChoice.jpg"
Shop.AlternateText = "Shopping choices"
' Add the ImageMap control to the
' Controls collection of the page.
Page.Controls.Add(Shop)
' Programmatically create a CircleHotSpot object.
Dim Circle1 As New CircleHotSpot
Circle1.HotSpotMode = HotSpotMode.Navigate
Circle1.NavigateUrl = "http://www.tailspintoys.com"
Circle1.X = 145
Circle1.Y = 120
Circle1.Radius = 75
Circle1.AlternateText = "Shop for toys"
' Add Circle1 to the ImageMap's HotSpotCollection.
Shop.HotSpots.Add(Circle1)
' Programmatically create a second CircleHotSpot object.
Dim Circle2 As New CircleHotSpot
Circle2.HotSpotMode = HotSpotMode.Navigate
Circle2.NavigateUrl = "http://www.cohowinery.com"
Circle2.X = 145
Circle2.Y = 290
Circle2.Radius = 75
Circle2.AlternateText = "Shop for wine"
' Add Circle2 to the ImageMap's HotSpotCollection.
Shop.HotSpots.Add(Circle2)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>ImageMap Class VB Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>ImageMap Class VB Constructor Example</h3>
<h4>Shopping Choices:</h4>
</form>
</body>
</html>
備註
類別 HotSpotCollection 代表集合,可讓 ImageMap 控件維護其所包含的物件清單 HotSpot 。
Add使用 方法,將指定的HotSpot物件新增至序數索引陣列結尾的集合。 Insert使用 方法,將物件加入HotSpot集合中指定的索引位置。 Item[]使用索引器,使用簡單的數位表示法,直接存取HotSpot集合中指定索引處的物件。
Remove使用 方法,從集合結尾移除 HotSpot 物件。 RemoveAt使用方法可從指定的索引位置移除 HotSpot 物件。
建構函式
HotSpotCollection() |
初始化 HotSpotCollection 類別的新執行個體。 |
屬性
Count |
取得 StateManagedCollection 集合中所包含的項目數。 (繼承來源 StateManagedCollection) |
Item[Int32] |
取得位於 HotSpot 集合中指定索引處的 HotSpotCollection 物件參考。 |
方法
明確介面實作
擴充方法
Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
OfType<TResult>(IEnumerable) |
根據指定的型別來篩選 IEnumerable 的項目。 |
AsParallel(IEnumerable) |
啟用查詢的平行化作業。 |
AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |