Code Listing for: CustomHotSpot.vb
Imports Microsoft.VisualBasic
Namespace imhs
Public Class DiamondHotSpot
Inherits System.Web.UI.WebControls.HotSpot
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal CenterX As Integer, ByVal CenterY As Integer, _
ByVal Width As Integer, ByVal Height As Integer)
MyBase.New()
Me.CenterX = CenterX
Me.CenterY = CenterY
Me.Width = Width
Me.Height = Height
End Sub
Public Property CenterX() As Integer
Get
Dim val As Object = ViewState("centerx")
If val Is Nothing Then
Return 0
Else
Return CInt(val)
End If
End Get
Set(ByVal value As Integer)
ViewState("centerx") = value
End Set
End Property
Public Property CenterY() As Integer
Get
Dim val As Object = ViewState("centery")
If val Is Nothing Then
Return 0
Else
Return CInt(val)
End If
End Get
Set(ByVal value As Integer)
ViewState("centery") = value
End Set
End Property
Public Property Width() As Integer
Get
Dim val As Object = ViewState("width")
If val Is Nothing Then
Return 0
Else
Return CInt(val)
End If
End Get
Set(ByVal value As Integer)
ViewState("width") = value
End Set
End Property
Public Property Height() As Integer
Get
Dim val As Object = ViewState("height")
If val Is Nothing Then
Return 0
Else
Return CInt(val)
End If
End Get
Set(ByVal value As Integer)
ViewState("height") = value
End Set
End Property
Protected Overrides ReadOnly Property MarkupName() As String
Get
Return "poly"
End Get
End Property
Public Overrides Function GetCoordinates() As String
Return CenterX.ToString() & "," & (CenterY - Height / 2).ToString() & "," & _
(CenterX + Width / 2).ToString() & "," & CenterY.ToString() & "," & _
CenterX.ToString() & "," & (CenterY + Height / 2).ToString() & "," & _
(CenterX - Width / 2).ToString() & "," & CenterY.ToString()
End Function
End Class
End Namespace