-[Danny Chen]- Blog of an ASP.NET QA tester

Tips and info about Site Navigation, ImageMap, Menu and other cool ASP.NET v2.0 features.

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

Posted: Apr 11 2005, 10:51 AM by dannychen | with 3 comment(s)
Filed under:

Comments

TrackBack said:

# April 11, 2005 5:23 PM

TrackBack said:

# April 11, 2005 5:32 PM

weblogs.asp.net said:

399870.. He-he-he :)

# May 21, 2011 2:49 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)