Design time ImageIndex editor problem

snarfblam

Ultimate Contributor
Joined
Jun 10, 2003
Messages
2,097
Location
USA
I am making a component that inherits from MenuItem, and another that inherits from MainMenu to contain my menu items. Much of the behavior of my menu items depends on properties of the MainMenu.

My menu items can display images from an imagelist specified as a property of my main menu. I have implemented the ImageIndex and ImageList properties exactly as I have seen in many examples, like so:

Visual Basic:
    'Specify Design time category, editor, and type converter
    <Category("Appearance"), _
    Description("Image from specified image list to be displayed for this menu item, if nothing is specified for the property ""Image"""), _
    Editor("System.Windows.Forms.Design.ImageIndexEditor", _ 
    GetType(System.Drawing.Design.UITypeEditor)), TypeConverter(GetType(ImageIndexConverter))> _
    Public Property ImageIndex() As Integer
        Get
            Return _ImageIndex
        End Get
        Set(ByVal Value As Integer)
            _ImageIndex = Value
        End Set
    End Property
'
    'Necessary for design time ImageIndex editor
    <EditorBrowsable(EditorBrowsableState.Advanced), _
    Browsable(False)> _
    ReadOnly Property ImageList() As ImageList
        Get
            If _MainMenu Is Nothing Then
                FindParents() 'Find the containing MainMenu if necessary
            End If
            If _MainMenu.ImageList Is Nothing Then MsgBox("This is the problem")
            Return _MainMenu.ImageList
        End Get
    End Property

My problem is a designer problem.
The thumbnails don't show up during design time when I am selecting the image index in the property grid. The available indecies and "(none)" appear in the dropdown list, just not the thumbnails.
 
Back
Top