1 Replies - 316 Views - Last Post: 27 September 2013 - 05:53 AM Rate Topic: -----

#1 fugio  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 21-July 13

How to create a group of properties

Posted 27 September 2013 - 12:35 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; }
        }
    }
}



Is This A Good Question/Topic? 0
  • +

Replies To: How to create a group of properties

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: How to create a group of properties

Posted 27 September 2013 - 05:53 AM

If you check my signature block there is a link to a tutorial on properties.

I'd also point you at the tutorial on WPF. Since this is all equally new to you, you should be learning WPF instead of doing it in the older WinForms method. Binding properties to control is a foundation concept of WPF and sounds like exactly what you need to do. WinForm is the old way, WPF is the quickly growing new way to build GUI's. It's a little more learning curve but once you get into it you'll love it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1