public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
// We want to hide the tint-related properties if they aren't
// using tinting, and hide the lighting 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 ((!_useTint) &&
((property.Name == "RedTint") ||
(property.Name == "GreenTint") ||
(property.Name == "BlueTint") ||
(property.Name == "TintSaturation") ||
(property.Name == "TintLuminance")))
{
wantThisProperty = false;
}
else if ((_useTint) && (property.Name == "LightLevel"))
{
wantThisProperty = false;
}
if (wantThisProperty)
{
wantProperties.Add(property);
}
}
return new PropertyDescriptorCollection(wantProperties.ToArray());
}