CircleHotSpot 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 CircleHotSpot 类的新实例。
public:
CircleHotSpot();
public CircleHotSpot ();
Public Sub New ()
示例
下面的代码示例演示如何以编程方式创建两个 CircleHotSpot 对象,设置其属性,并将其添加到 ImageMap 控件的 HotSpotCollection。 若要使此示例正常工作,必须为 属性提供自己的映像 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 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";
// 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 the CirclHotSpot objects to the
// Shop ImageMap control's HotSpotCollection.
Shop.HotSpots.Add(Circle1);
Shop.HotSpots.Add(Circle2);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>CircleHotSpot Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>CircleHotSpot Constructor Example</h3>
<h4>Shopping Choices:</h4>
<asp:imagemap id="Shop"
imageurl="Images/ShopChoice.jpg"
alternatetext="Shopping choices"
runat="Server">
</asp:imagemap>
</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 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"
' 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 the CirclHotSpot objects to the
' Shop ImageMap control's HotSpotCollection.
Shop.HotSpots.Add(Circle1)
Shop.HotSpots.Add(Circle2)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>CircleHotSpot Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>CircleHotSpot Constructor Example</h3>
<h4>Shopping Choices:</h4>
<asp:imagemap id="Shop"
imageurl="Images/ShopChoice.jpg"
alternatetext="Shopping choices"
runat="Server">
</asp:imagemap>
</form>
</body>
</html>
注解
使用此构造函数初始化 类的新实例 CircleHotSpot 。