typedescriptorfilterservice.cs

来自「全功能c#编译器」· CS 代码 · 共 65 行

CS
65
字号
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>

using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;

namespace ICSharpCode.SharpDevelop.FormDesigner.Services
{
	public class TypeDescriptorFilterService : ITypeDescriptorFilterService
	{
		IDesignerFilter GetDesignerFilter(IComponent component)
		{
			ISite site = component.Site;
			
			if (site == null) {
				return null;
			}
			
			IDesignerHost host = (IDesignerHost)site.GetService(typeof(IDesignerHost));
			if (host == null)
				return null;
			return host.GetDesigner(component) as IDesignerFilter;
		}
		

#region System.ComponentModel.Design.ITypeDescriptorFilterService interface implementation
		public bool FilterProperties(System.ComponentModel.IComponent component, System.Collections.IDictionary properties)
		{
			IDesignerFilter designerFilter = GetDesignerFilter(component);
			if (designerFilter != null) {
				designerFilter.PreFilterProperties(properties);
				designerFilter.PostFilterProperties(properties);
			}
			return false;
		}
		
		public bool FilterEvents(System.ComponentModel.IComponent component, System.Collections.IDictionary events)
		{
			IDesignerFilter designerFilter = GetDesignerFilter(component);
			if (designerFilter != null) {
				designerFilter.PreFilterEvents(events);
				designerFilter.PostFilterEvents(events);
			}
			return false;
		}
		
		public bool FilterAttributes(System.ComponentModel.IComponent component, System.Collections.IDictionary attributes)
		{
			IDesignerFilter designerFilter = GetDesignerFilter(component);
			if (designerFilter != null) {
				designerFilter.PreFilterAttributes(attributes);
				designerFilter.PostFilterAttributes(attributes);
			}
			return false;
		}
#endregion
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?