コード例 #1
0
ファイル: CustomClass.cs プロジェクト: jugstalt/gViewGisOS
 public CustomPropertyDescriptor(ref CustomProperty myProperty, Attribute[] attrs)
     : base(myProperty.Name, attrs)
 {
     m_Property = myProperty;
 }
コード例 #2
0
ファイル: CustomClass.cs プロジェクト: jugstalt/gViewGisOS
 /// <summary>
 /// Add CustomProperty to Collectionbase List
 /// </summary>
 /// <param name="Value"></param>
 public void Add(CustomProperty Value)
 {
     base.List.Add(Value);
 }
コード例 #3
0
ファイル: CustomClass.cs プロジェクト: jugstalt/gview5
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptor[] newProps = new PropertyDescriptor[this.Count];
            for (int i = 0; i < this.Count; i++)
            {
                CustomProperty prop = (CustomProperty)this[i];

                Attribute[] propAttributes = new Attribute[attributes.Length + prop.CustomAttributes.Length];
                attributes.CopyTo(propAttributes, 0);
                prop.CustomAttributes.CopyTo(propAttributes, attributes.Length);

                for (int p = 0; p < propAttributes.Length; p++)
                {
                    if (propAttributes[p] is UseColorPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(ColorTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseWidthPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(PenWidthTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseDashStylePicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(DashStyleTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseHatchStylePicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(HatchStyleTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseLineSymbolPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(LineSymbolTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UsePointSymbolPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(PointSymbolTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseCharacterPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(CharacterTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseFilePicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(FileTypeEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                    if (propAttributes[p] is UseColorGradientPicker)
                    {
                        propAttributes[p] = new EditorAttribute(typeof(ColorGradientEditor), typeof(System.Drawing.Design.UITypeEditor));
                        break;
                    }
                }

                newProps[i] = new CustomPropertyDescriptor(ref prop, propAttributes);
            }

            return(new PropertyDescriptorCollection(newProps));
        }