Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ImageIndex
 

ImageIndex

Ok I have a custom treeview

I've added more properties

    Public Property Table_ImageIndex() As Integer
        Get
            Return _TableIndex
        End Get
        Set(ByVal Value As Integer)
            _TableIndex = Value
        End Set
    End Property

The quesiton is this: I want to be able in the properybrowser to be able to set the image index of the image list like I do for the imageindex property. 

Ok the control as an imagelist and an imageindex propery already before I inherted it and added the propery above. Though currently in the properygrid I just get a number instead of being able to set the image using a little drop down like the imageindex propery has.

How do I duplicate the Imageindex propery behavior?

Joe
MigrationUser 1  Tuesday, November 18, 2003 4:00 PM
You must use the following converter and editor:
<b>
[Editor("System.Windows.Forms.Design.ImageIndexEditor", typeof(UITypeEditor))]
[TypeConverter(typeof(ImageIndexConverter))]
</b>

This is an example from the SmartLibrary in C#

<b>

/// <summary>
/// Internal store for "public int IconImageIndex"
/// </summary>
private int ixIconImageIndex = -1;
/// <summary>
/// Gets or sets the image list index value of the icon image displayed on the notification box.
/// </summary>
#if(Design_Time)
[Category("Appearance")]
[Description("Gets or sets the image list index value of the icon image displayed on the notification box.")]
[Editor("System.Windows.Forms.Design.ImageIndexEditor", typeof(UITypeEditor))]
[TypeConverter(typeof(ImageIndexConverter))]
#endif
public int IconImageIndex
{
get
{
return this.ixIconImageIndex;
}
set
{
this.ixIconImageIndex = value;
}
}

#if(Design_Time)
/// <summary>
/// The default value for (IconImageIndex) is (-1).
/// Prevent Microsoft Visual Studio.NET repeating that value again in the automatically generated source code.
/// </summary>
// <returns>True (generate code), false (don't generate code)</returns>
private bool ShouldSerializeIconImageIndex()
{
return (this.ixIconImageIndex == -1) ? false : true;
}
#endif

</b>
MigrationUser 1  Saturday, November 22, 2003 10:15 AM
Ok but this doesn't show the thumbnail of the image like the other ones do.

Any idea how to get the thumbnail to show up in the property browser?

Joe
MigrationUser 1  Monday, December 22, 2003 5:01 PM

You can use google to search for other answers

Custom Search

More Threads

• ByteViewer
• Stored procedure vs Query in VB.Net and backend - SQL Server 2000?
• Nested datagrid views?
• Big Problem, I think it's bug
• How customize data in datagridview with bound columns?
• Form designer error - please HELP ME
• Panel Control
• Visual Studio 2005 MaskedTextBox
• autogenerated GUI form/winform from BL?
• Intercepting Container Control