www.pudn.com > CustomFormsDesigner.rar > TypeDescriptorFilterServiceImpl.cs, change:2004-07-08,size:1802b


using System; 
using System.Collections; 
using System.ComponentModel; 
using System.ComponentModel.Design; 
using System.ComponentModel.Design.Serialization; 
using System.Drawing; 
using System.Drawing.Design; 
using System.Windows.Forms; 
using System.Windows.Forms.Design; 
 
namespace FormDesigner.impls 
{ 
	public class TypeDescriptorFilterServiceImpl:ITypeDescriptorFilterService 
	{ 
		private IDesignerHost host; 
		public TypeDescriptorFilterServiceImpl(IDesignerHost host) 
		{ 
			this.host=host; 
		} 
		#region ITypeDescriptorFilterService Members 
 
		public bool FilterAttributes(IComponent component, IDictionary attributes) 
		{ 
			IDesigner designer = host.GetDesigner(component); 
			if (designer is IDesignerFilter) 
			{ 
				IDesignerFilter designerFilter = designer as IDesignerFilter; 
 
				designerFilter.PreFilterAttributes(attributes); 
				designerFilter.PostFilterAttributes(attributes); 
 
				return true; 
			} 
 
			return false; 
		} 
	 
		public bool FilterEvents(IComponent component, IDictionary events) 
		{ 
			IDesigner designer = host.GetDesigner(component); 
			if (designer is IDesignerFilter) 
			{ 
				IDesignerFilter designerFilter = designer as IDesignerFilter; 
				 
				designerFilter.PreFilterEvents(events); 
				designerFilter.PostFilterEvents(events); 
 
				return true; 
			} 
 
			return false; 
		} 
	 
		public bool FilterProperties(IComponent component, IDictionary properties) 
		{ 
			IDesigner designer = host.GetDesigner(component); 
			if (designer is IDesignerFilter) 
			{ 
				IDesignerFilter designerFilter = designer as IDesignerFilter; 
				 
				designerFilter.PreFilterProperties(properties); 
				designerFilter.PostFilterProperties(properties); 
 
				return true; 
			} 
 
			return false; 
		} 
 
 
		#endregion 
	} 
}