Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to use the rectangleshape in that.Below is my code :

<ProvideProperty("Index", GetType(RectangleShape))> Friend Class RectangleShapeArray
    Inherits BaseControlArray
    Implements IExtenderProvider

    Public Event [Click] As System.EventHandler

    Public Sub New()
        MyBase.New()
    End Sub

    Public Sub New(ByVal Container As IContainer)
        MyBase.New(Container)
    End Sub

    Public Function CanExtend(ByVal Target As Object) As Boolean Implements IExtenderProvider.CanExtend
        If TypeOf Target Is RectangleShape Then
            Return BaseCanExtend(Target)
        End If
    End Function

    Public Function GetIndex(ByVal o As RectangleShape) As Short
        Return BaseGetIndex(o)
    End Function

    Public Sub SetIndex(ByVal o As RectangleShape, ByVal Index As Short)
        BaseSetIndex(o, Index)
    End Sub

    Public Function ShouldSerializeIndex(ByVal o As RectangleShape) As Boolean
        Return BaseShouldSerializeIndex(o)
    End Function

    Public Sub ResetIndex(ByVal o As RectangleShape)
        BaseResetIndex(o)
    End Sub

    Public Shadows Sub Load(ByVal Index As Short)
        MyBase.Load(Index)
        CType(Item(0).Parent, ShapeContainer).Shapes.Add(Item(Index))
    End Sub

    Public Shadows Sub Unload(ByVal Index As Short)
        CType(Item(0).Parent, ShapeContainer).Shapes.Remove(Item(Index))
        MyBase.Unload(Index)
    End Sub

    Default Public ReadOnly Property Item(ByVal Index As Short) As RectangleShape
        Get
            Item = CType(BaseGetItem(Index), RectangleShape)
        End Get
    End Property

    Protected Overrides Sub HookUpControlEvents(ByVal o As Object)

        Dim ctl As RectangleShape
        ctl = CType(o, RectangleShape)

        If Not IsNothing(ClickEvent) Then
            AddHandler ctl.Click, ClickEvent
        End If

    End Sub

    Protected Overrides Function GetControlInstanceType() As System.Type
        Return GetType(RectangleShape)
    End Function

End Class


What I have tried:

I have tried many arrays, but its not suitable for this.please help me in this ...thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900