상속: System.Windows.Forms.UserControl
예제 #1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if( value.GetType() != typeof(Color))
                return value;

            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if( edSvc != null )
            {
                ColorEditorControl editor = new ColorEditorControl((Color)value);
                edSvc.DropDownControl( editor );

                // Return the value in the appropraite data format.
                if( value.GetType() == typeof(Color) )
                    return editor.color;
            }
            return value;
        }
예제 #2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(Color))
            {
                return(value);
            }

            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                ColorEditorControl editor = new ColorEditorControl((Color)value);
                edSvc.DropDownControl(editor);

                // Return the value in the appropraite data format.
                if (value.GetType() == typeof(Color))
                {
                    return(editor.color);
                }
            }
            return(value);
        }