Пример #1
0
        public void EditValue_Invoke_ReturnsValue(object value)
        {
            var editor = new UITypeEditor();

            Assert.Same(value, editor.EditValue(null, value));
            Assert.Same(value, editor.EditValue(null, null, value));
        }
Пример #2
0
        public void Ctor_Properties_DefaultValues()
        {
            var editor = new UITypeEditor();

            using (var bm = new Bitmap(10, 10))
                using (var graphics = Graphics.FromImage(bm))
                {
                    Assert.False(editor.IsDropDownResizable);
                    Assert.Equal(graphics, editor.EditValue(null, graphics));
                    Assert.Equal(graphics, editor.EditValue(null, null, graphics));
                    Assert.Equal(UITypeEditorEditStyle.None, editor.GetEditStyle());
                    Assert.Equal(UITypeEditorEditStyle.None, editor.GetEditStyle(null));
                    Assert.False(editor.GetPaintValueSupported());
                    Assert.False(editor.GetPaintValueSupported(null));

                    // nop
                    editor.PaintValue(bm, graphics, Rectangle.Empty);
                }
        }
 /// <summary>
 ///  Edits the given object value using the editor style provided by
 ///  GetEditorStyle.  A service provider is provided so that any
 ///  required editing services can be obtained.
 /// </summary>
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (innerEditor != null)
     {
         return(innerEditor.EditValue(context, provider, value));
     }
     else
     {
         return(base.EditValue(context, provider, value));
     }
 }
Пример #4
0
        private object EditValueResourcePicker(System.Drawing.Design.UITypeEditor defaultEditor, System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            object obj;

            System.Windows.Forms.Application.AddMessageFilter(this);
            FoundResourcePickerDialog = false;
            try
            {
                obj = defaultEditor.EditValue(context, provider, value);
            }
            finally
            {
                System.Windows.Forms.Application.RemoveMessageFilter(this);
                DetachEvents();
            }
            return(obj);
        }