如何写自定义类啊?并将类引用在页面上??
为了学习这个的用法我的写法如下
1. 创建DiamondHotSpot类
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace HotSpotTest
{
public class DiamondHotSpot : System.Web.UI.WebControls.HotSpot
{
public int CenterX
{
get
{
object val = ViewState["centerx"];
if (val == null)
return 0;
else
return (int)val;
}
set
{
ViewState["centerx"] = value;
}
}
public int CenterY
{
get
{
object val = ViewState["centery"];
if (val == null)
return 0;
else
return (int)val;
}
set
{
ViewState["centery"] = value;
}
}
public int Width
{
get
{
object val = ViewState["width"];
if (val == null)
return 0;
else
return (int)val;
}
set
{
ViewState["width"] = value;
}
}
public int Height
{
get
{
object val = ViewState["height"];
if (val == null)
return 0;
else
return (int)val;
}
set
{
ViewState["height"] = value;
}
}
protected override string MarkupName
{
get
{
return "poly";
}
}
public override string GetCoordinates()
{
return CenterX.ToString() + "," +
(CenterY - Height / 2).ToString() + "," +
(CenterX + Width / 2).ToString() + "," +
CenterY.ToString() + "," +
CenterX.ToString() + "," +
(CenterY + Height / 2).ToString() + "," +