wroxbuttonconverter.cs

来自「ASP.NET服务器控件高级编程电子书」· CS 代码 · 共 38 行

CS
38
字号
using System;
using System.Drawing.Design;
using System.ComponentModel;
using System.ComponentModel.Design;

namespace WroxDesign.Design
{
	public class WroxButtonConverter : TypeConverter
	{
		public WroxButtonConverter()
		{
		}

		public override PropertyDescriptorCollection GetProperties(
			ITypeDescriptorContext context, object value, 
			Attribute[] attributes)
		{
			//This is the default behavior
//			return TypeDescriptor.GetProperties(context.Instance,
//				new Attribute[] { new BrowsableAttribute(true) });

			//If we are outside the host designer, we are in a custom editor
			if (context.Container == null)
                return TypeDescriptor.GetProperties(context.Instance,
					new Attribute[] { new ToolBarEditableAttribute() });
			
			//Otherwise, return the solicited members
			return TypeDescriptor.GetProperties(context.Instance, attributes);
		}

		public override bool GetPropertiesSupported(
			ITypeDescriptorContext context)
		{
			return true;
		}
	}
}

⌨️ 快捷键说明

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