Instead of a general control, you can use a regular subclass with Property:
public class GComboBox : ComboBox { public Type myType { get; set; } public GComboBox(Type type) { myType = type; } public GComboBox() { myType = typeof(int); } public override string ToString() { return "GComboBox<" + myType.ToString() + ">"; } }
This will appear in the toolbar as expected. By default, it is equal to System.Int32 , which you must adapt after placing it, for example. in the form constructor.
InitializeComponent(); gComboBox1.myType = typeof(Bitmap);
Not sure how you could prevent the addition of the wrong types, though .. There is no ItemAdded event. This post suggests listening to ComboBox posts, but most posts tell you that you still control the addition of items.
source share