zoukankan      html  css  js  c++  java
  • c# PropertyGrid 多层折叠 示例

    PropertyGrid 多层折叠使用方法:

    ///子子元素

    public class school
        {
            public string Address{set;get;}
            public string Name{set;get;}
            public string Sex{set;get;}
            public override string  ToString()
            {
                return Address+Name+Sex;
            }
        }

    ///子元素
        public class SystemConfig
        {
            public string ConfigName { set; get; }
            private school _school = new school();
            [TypeConverter(typeof(ExpandableObjectConverter)),Category("学生")]
            public school MySchool1
            {
                set { _school = value; }
                get { return _school; }
            }

      ///
            public override string ToString()
            {
                return ConfigName + MySchool1;
            }
        }

    /// root元素
        public class attributes
        {
            [Category("学生")]
            public string Ages { get; set; }
            
            private SystemConfig _config = new SystemConfig();
            [TypeConverter(typeof(ExpandableObjectConverter)), Category("地址")]
            public SystemConfig config
            {
                set { _config = value; }
                get { return _config; }
            }
        }

    注意事项:

    1.重写override 函数 返回当前类的member .

    2.自定义类保证一定构造了. 否则该类不显示member

    3.自定义类使用[typeconverte(typeof(expandableobjectconverter))] 进行类型转换

    4.category("标识属于哪个root下") ,displayName("标识显示名称") defaultvalue...

    5.自定义编辑框 EditorAttribute(typeof(PropertyGridRichText),typeof(System.Drawing.Design.UITypeEditor))

    自定义类 class PropertyGridRichText : UITypeEditor 等等.

    Demo地址

  • 相关阅读:
    java PKCS7Padding 加密Cannot find any provider supporting AES/CBC/PKCS7Padding 解决办法
    win7系统c盘瘦身,去虚拟内存方式
    跟据经纬度实现附近搜索Java实现
    Java 406
    window.showModalDialog 子窗口和父窗口不兼容最新的谷歌
    <html:text> Id属性
    Unity3D GUI学习之GUI窗口的使用
    Unity3D GUI学习之GUILayout控件及使用
    Unity3D GUI之自定义风格组件
    Unity3D GUI学习
  • 原文地址:https://www.cnblogs.com/nameliu/p/3325410.html
Copyright © 2011-2022 走看看