示例#1
0
        public void GetEditStyle_Invoke_ReturnsNone()
        {
            var editor = new UITypeEditor();

            Assert.Equal(UITypeEditorEditStyle.None, editor.GetEditStyle());
            Assert.Equal(UITypeEditorEditStyle.None, editor.GetEditStyle(null));
        }
 /// <summary>
 ///  Retrieves the editing style of the Edit method.  If the method
 ///  is not supported, this will return None.
 /// </summary>
 public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
 {
     if (innerEditor != null)
     {
         return(innerEditor.GetEditStyle(context));
     }
     return(base.GetEditStyle(context));
 }
示例#3
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>
 ///     Creates a new TypeEditorHost to display the given UITypeEditor
 /// </summary>
 /// <param name="editor">The UITypeEditor instance to host</param>
 /// <param name="propertyDescriptor">Property descriptor used to get/set values in the drop-down.</param>
 /// <param name="instance">Instance object used to get/set values in the drop-down.</param>
 protected TypeEditorHost(UITypeEditor editor, PropertyDescriptor propertyDescriptor, object instance)
     :
         this(UITypeEditorEditStyle.DropDown, propertyDescriptor, instance, TypeEditorHostEditControlStyle.Editable)
 {
     _uiTypeEditor = editor;
     if (editor != null)
     {
         _editStyle = editor.GetEditStyle(this);
     }
 }