zoukankan      html  css  js  c++  java
  • Dot Net WinForm 控件开发 (五) 复杂属性的子属性



    看到了吧? ComplexProperty 属性的子属性 Max, Min 也可以被编辑了.

    实现这些很简单,只需要在这个属性的类型的类型转换器中重载两个方法即可
     1        /// <summary>
     2        /// 使用指定的上下文返回该对象是否支持属性 (Property)。
     3        /// </summary>

     4        public override bool GetPropertiesSupported(ITypeDescriptorContext context)
     5        {
     6            return true;
     7        }

     8
     9        /// <summary>
    10        /// 使用指定的上下文和属性 (Attribute) 返回由 value 参数指定的数组类型的属性 (Property) 的集合。
    11        /// </summary>

    12        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, System.Attribute[] attributes)
    13        {
    14            return TypeDescriptor.GetProperties(typeof(SimpleCustomType), attributes);
    15        }

    16

    The end.
  • 相关阅读:
    结构型模式上
    创建型模式下
    创建型模式中
    创建型模式上
    设计模式总述
    Java中事件机制
    UI常用控件
    UITextField和UIViewConteoller
    UIScrollView 和 UIPageControl
    分栏视图控制器
  • 原文地址:https://www.cnblogs.com/luqingfei/p/674797.html
Copyright © 2011-2022 走看看