fugio huynh

fugio huynh

  • NA
  • 51
  • 16.8k

How to create a group of properties

Sep 27 2013 3:37 AM
Hi all,
I'm trying to create a control and command control them from the property, there are too many similar statements. I want to cage them in a group of properties, so I have created a class that contains the property and call them from the main property of a control class.
I have a small statement, but does not work. how to display the property in the father's property
Specific CustomForeColor in DisplayCustomProperties
Thanks for your help
using System.ComponentModel;

namespace WindowsFormsApplication1
{
   public class CustomPanel: Label 
    {
       private CustomProperties _DisplayCustomProperties;
      [Browsable(true),Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] 
        public CustomProperties DisplayCustomProperties
        {
            get
            {
                return _DisplayCustomProperties;
            }
            set
            {
                _DisplayCustomProperties = value;
            }
        }
     }
}
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace WindowsFormsApplication1
{
    public abstract class CustomProperties 
    {
        public enum ArrowColor { Red, Green, Magenta, Pink, Orange, Black, Yellow };
        protected CustomPanel _cpl;
        public CustomProperties(CustomPanel cpl)
        {
            this._cpl = cpl;
        }

        private ArrowColor _CustomForeColor;
        [Browsable(true), Category("Appearance")]
        public ArrowColor CustomForeColor{
            get { return _CustomForeColor; }
            set { _CustomForeColor = value; }
        }
    }
}