Click here to Skip to main content
15,893,814 members
Articles / Multimedia / GDI+

Analog Clock Control

Rate me:
Please Sign up or sign in to vote.
4.58/5 (66 votes)
23 Jan 2010CPOL4 min read 319.9K   30.7K   138  
The analog clock control is a control that has almost all the functionality that a clock control can have, and it is fully modifiable.
''' <summary>
''' Provides a type editor for the AnalogClock.Element array objects.
''' </summary>
<DebuggerNonUserCode()> _
Public Class ElementArrayEditor
    Inherits System.ComponentModel.Design.ArrayEditor

#Region " Methods "

    Sub New(ByVal arrayType As Type)
        MyBase.New(arrayType)
    End Sub

    Protected Overrides Function CreateCollectionForm() As System.ComponentModel.Design.CollectionEditor.CollectionForm
        Dim form As System.ComponentModel.Design.CollectionEditor.CollectionForm = MyBase.CreateCollectionForm()
        form.StartPosition = FormStartPosition.CenterParent
        Dim ctrl As Control = form.Controls("overArchingTableLayoutPanel")
        ' Disables Add/Remove buttons
        ctrl.Controls("addRemoveTableLayoutPanel").Enabled = False

        ' Get a reference to the private fieldtype propertyBrowser
        ' This is the propertgrid inside the collectionform
        Dim fInfo As Reflection.FieldInfo = form.GetType.GetField("propertyBrowser", _
                                                                  Reflection.BindingFlags.NonPublic _
                                                                  Or Reflection.BindingFlags.Instance)
        If fInfo IsNot Nothing Then
            ' get a reference to the propertygrid instance located on the form
            Dim pGrid As PropertyGrid = CType(fInfo.GetValue(form), PropertyGrid)
            If pGrid IsNot Nothing Then
                ' Make the help/description visible
                pGrid.HelpVisible = True
            End If
        End If
        Return form
    End Function

    Protected Overrides Function CanSelectMultipleInstances() As Boolean
        Return True
    End Function

#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 (Senior) ZipEdTech
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions