|
Public Class StatusCollection
Inherits CollectionBase
#Region " Declarations "
Private Parent As StatusList ' The StatusLabel control associated with this collection
#End Region
#Region " Methods "
' Constructor
Friend Sub New(ByVal Parent As StatusList)
' the status label control associated with this collection
Me.Parent = Parent
End Sub
' Gets the index of a specified item
Public Function IndexOf(ByVal Item As StatusItem) As Int16
Return List.IndexOf(Item)
End Function
' Get the item at a specified index
Default Public ReadOnly Property Item(ByVal Index As Integer) As StatusItem
Get
Return DirectCast(List(Index), StatusItem)
End Get
End Property
' Check if the collection contains a specified item
Public Function Contains(ByVal item As StatusItem) As Boolean
Return List.Contains(item)
End Function
' Adds a new statusitem to the collection
Public Function Add(ByVal item As StatusItem) As Integer
Dim i As Integer
i = List.Add(item)
item.Parent = Parent
Parent.DrawItems()
Return i
End Function
' Removes a specified item from the collections
Public Sub Remove(ByVal item As StatusItem)
List.Remove(item)
item.Parent = Nothing
Parent.DrawItems()
End Sub
' Occurs when the collection has successfully added a new item. For painting and validating purposes during design mode.
Protected Overrides Sub OnInsertComplete(ByVal index As Integer, ByVal value As Object)
MyBase.OnInsert(index, value)
Parent.DrawItems()
Parent.Invalidate()
End Sub
#End Region
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Shaps currently works as the Senior Networks Administrator for a small IT company in Australia. He is also involved in various software developments, for Windows, Windows Mobile, iPhone, Mac and occasionally the web. His central focus in this area, is User Interface design.
If he had spare time, he'd play some tunes, read a book or visit the gym. Until then, he writes small applications for the iPhone that help improve his productivity at work.