Exemplo n.º 1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            if (_editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            if (value != null && !(value is Color?))
            {
                return(base.EditValue(context, provider, value));
            }

            Color?       c     = (Color?)value;
            C1SolidBrush brush = new C1SolidBrush(c.HasValue ? c.Value : Color.Empty);

            var editor = new BackgroundEditorControl(_editorService);

            editor.Init(brush, false, true, NullValueAlias);
            _editorService.DropDownControl(editor);
            brush = editor.Background as C1SolidBrush;
            if (brush == null || brush.Color.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(brush.Color);
            }
        }
Exemplo n.º 2
0
        private void Designer_DoSetBackground(Color color)
        {
            C1SolidBrush bg = new C1SolidBrush(color);

            _flexDesigner.DoSetBackground(bg, true);
        }