/// <summary> /// Adds a new property to the property descriptor collection. /// </summary> /// <param name="name">The name of the property displayed in the property grid.</param> /// <param name="type">The fully qualified name of the type of the property.</param> public void AddProperty(string name, Type type) { PropertySpec widthSpec = new PropertySpec(name, type); PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor(); pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue); pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue); mProperties.Add(pd); }
/// <summary> /// Initializes a new instance of the <see cref="T:PropertySpecDescriptor"/> class. /// </summary> /// <param name="item">The item.</param> /// <param name="attributes">the attributes to be used on the descriptor. Note that the attributes of the <see cref="PropertySpec"/> have to be previously taken over and overloaded.</param> public PropertySpecDescriptor(PropertySpec item, Attribute[] attributes) : base(item.Name, attributes) { this.item = item; }
/// <summary> /// Adds a new property to the property descriptor collection. /// </summary> /// <param name="name">The name of the property displayed in the property grid.</param> /// <param name="type">A Type that represents the type of the property.</param> /// <param name="category">The category under which the property is displayed in the /// property grid.</param> /// <param name="description">A string that is displayed in the help area of the /// property grid.</param> /// <param name="defaultValue">The default value of the property, or null if there is /// no default value.</param> /// <param name="editor">The Type that represents the type of the editor for this /// property. This type must derive from UITypeEditor.</param> /// <param name="typeConverter">The Type that represents the type of the type /// converter for this property. This type must derive from TypeConverter.</param> public void AddProperty(string name, Type type, string category, string description, object defaultValue, Type editor, Type typeConverter) { PropertySpec widthSpec = new PropertySpec(name, type, category, description, defaultValue, editor, typeConverter); PropertySpecDescriptor pd = widthSpec.ToPropertyDescriptor(); pd.OnGetValue += new EventHandler<PropertyEventArgs>(GetValue); pd.OnSetValue += new EventHandler<PropertyEventArgs>(SetValue); mProperties.Add(pd); }