Click here to Skip to main content
15,895,011 members
Articles / Programming Languages / Visual Basic

Status List - Vista Style

Rate me:
Please Sign up or sign in to vote.
4.52/5 (12 votes)
31 Mar 2007CPOL1 min read 59.8K   2.3K   90  
A progress list for displaying the status of various tasks
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.

License

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


Written By
Software Developer uSoftware
Australia Australia
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.

Comments and Discussions