public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
// We want to hide the min & max scaling properties if they aren't
// using continuous scaling, and hide the standard scaling property
// if they are.
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this, attributes, true);
List<PropertyDescriptor> wantProperties = new List<PropertyDescriptor>();
foreach (PropertyDescriptor property in properties)
{
bool wantThisProperty = true;
if ((!_useContinuousScaling) &&
((property.Name == "MinScalingLevel") || (property.Name == "MaxScalingLevel")))
{
wantThisProperty = false;
}
else if ((_useContinuousScaling) && (property.Name == "ScalingLevel"))
{
wantThisProperty = false;
}
if (wantThisProperty)
{
wantProperties.Add(property);
}
}
return new PropertyDescriptorCollection(wantProperties.ToArray());
}