예제 #1
0
        /// <summary>
        /// This takes care of the actual value-change of the property.
        /// </summary>
        /// <param name="itdc">Standard ITypeDescriptorContext object.</param>
        /// <param name="isp">Standard IServiceProvider object.</param>
        /// <param name="value">The value as an object.</param>
        /// <returns>The new value as an object.</returns>
        public override object EditValue(ITypeDescriptorContext itdc, IServiceProvider isp, object value)
        {
            if (itdc != null && itdc.Instance != null && isp != null)
            {
                iwfes = (IWindowsFormsEditorService)isp.GetService(typeof(IWindowsFormsEditorService));

                if (iwfes != null)
                {
                    HatchStyle hs = HatchStyle.Weave;

                    //if(itdc.PropertyDescriptor.GetValue(itdc.Instance) is HatchStyle)
                    if (value is HatchStyle)
                    {
                        hs        = (HatchStyle)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd        = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    //EditorHatchStyleUI ehsui = new EditorHatchStyleUI(hs, Color.White, Color.Black); //FIX THIS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                    EditorHatchStyleUI ehsui = new EditorHatchStyleUI(HatchStyle.Trellis, Color.White, Color.Black);
                    ehsui.IWFES              = iwfes;
                    ehsui.ITDC               = itdc;
                    ehsui.HatchStyle         = (HatchStyle)value;
                    ehsui.HatchStyleChanged += new EditorHatchStyleUI.MWHatchStyleEventHandler(ValueChanged);

                    iwfes.DropDownControl(ehsui);
                    value = ehsui.HatchStyle;
                }
            }

            return(value);
        }
예제 #2
0
        /// <summary>
        /// This takes care of the actual value-change of the property.
        /// </summary>
        /// <param name="itdc">Standard ITypeDescriptorContext object.</param>
        /// <param name="isp">Standard IServiceProvider object.</param>
        /// <param name="value">The value as an object.</param>
        /// <returns>The new value as an object.</returns>
        public override object EditValue(ITypeDescriptorContext itdc, IServiceProvider isp, object value)
        {
            if(itdc != null && itdc.Instance != null && isp != null)
            {
                iwfes = (IWindowsFormsEditorService)isp.GetService(typeof(IWindowsFormsEditorService));

                if(iwfes != null)
                {
                    HatchStyle hs = HatchStyle.Weave;

                    //if(itdc.PropertyDescriptor.GetValue(itdc.Instance) is HatchStyle)
                    if(value is HatchStyle)
                    {
                        hs = (HatchStyle)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    //EditorHatchStyleUI ehsui = new EditorHatchStyleUI(hs, Color.White, Color.Black); //FIX THIS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                    EditorHatchStyleUI ehsui = new EditorHatchStyleUI(HatchStyle.Trellis, Color.White, Color.Black);
                    ehsui.IWFES = iwfes;
                    ehsui.ITDC = itdc;
                    ehsui.HatchStyle = (HatchStyle)value;
                    ehsui.HatchStyleChanged += new EditorHatchStyleUI.MWHatchStyleEventHandler(ValueChanged);

                    iwfes.DropDownControl(ehsui);
                    value = ehsui.HatchStyle;
                }
            }

            return value;
        }