Imports System.ComponentModel
Imports System.ComponentModel.Design.Serialization
Public Class Pagelist
Inherits System.Windows.Forms.UserControl
Private _pagecollection As New PageCollection()
Private _selectedPage As Panel
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public ReadOnly Property Pages() As PageCollection
Get
Return _pagecollection
Invalidate()
End Get
End Property
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
SetStyle(ControlStyles.DoubleBuffer, True)
_pagecollection = New PageCollection()
'Add any initialization after the InitializeComponent() call
End Sub
'UserControl overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
End Class
Public Class PageCollection
Inherits CollectionBase
Default Public Property Item(ByVal Index As Integer) As Panel
Get
Return DirectCast(list.Item(Index), Panel)
End Get
Set(ByVal Value As Panel)
list.Item(Index) = Value
End Set
End Property
Public Function Add(ByVal Item As Panel) As Integer
Return List.Add(Item)
End Function
End Class
'Public Class PageConverter
' Inherits TypeConverter
' Public Overloads Overrides Function CanConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As System.Type) As Boolean
' If destinationType Is GetType(InstanceDescriptor) Then
' Return True
' End If
' Return MyBase.CanConvertTo(context, destinationType)
' End Function
' Public Overloads Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
' If destinationType Is GetType(InstanceDescriptor) Then
' Dim cat As Panel = DirectCast(value, Panel)
' Dim cl As System.Reflection.ConstructorInfo = GetType(Panel).GetConstructor(System.Type.EmptyTypes)
' Return New InstanceDescriptor(cl, Nothing, False)
' End If
' Return MyBase.ConvertTo(context, culture, value, destinationType)
' End Function
'End Class