如何在自定义控件里添加复杂属性(struct,class等)

如何在自定义控件里添加复杂属性(struct,class等)_第1张图片

class TestComponent2 : System.Windows.Forms.DateTimePicker
    {
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public class Test
        {
            private int _A, _B;
            [Description("属性B")]
            public int B
            {
                get { return _B; }
                set { _B = value; }
            }
            [Description("属性A")]
            public int A
            {
                get { return _A; }
                set { _A = value; }
            }

            public  override string ToString()
            {
                return _A+","+_B;
            }
        }
        private Test _Test;
        [Description("自定义控件,里面含有结构体(类)"),Category("MyCategory")]
        public Test TestProperty
        {
            get { return _Test; }
            set { _Test = value; }
        }
    }


 

你可能感兴趣的:(如何在自定义控件里添加复杂属性(struct,class等))