public void FixtureSetUp () { editor = new UITypeEditor (); Bitmap bitmap = new Bitmap (20, 20); graphics = Graphics.FromImage (bitmap); }
public override object GetEditor(System.Type editorBaseType) { if ((editorBaseType == typeof(UITypeEditor)) && (this.editor == null)) { this.editor = new AboutBoxUITypeEditor(); } return this.editor; }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public CustomPropertyDescriptor(PropertyDocumentation documentation, UITypeEditor editor, Property property, Properties modifiedProperties) : base(documentation == null ? property.Name : documentation.ReadableName, null) { this.documentation = documentation; this.editor = editor; this.property = property; this.modifiedProperties = modifiedProperties; }
public CursorUI (UITypeEditor host, IWindowsFormsEditorService service, object value) { this.service = service; this.value = value; TypeConverter conv = TypeDescriptor.GetConverter (typeof (Cursor)); foreach (object o in conv.GetStandardValues()) base.Items.Add (o); }
public void PaintValue_Invoke_Nop() { using (var bm = new Bitmap(10, 10)) using (var graphics = Graphics.FromImage(bm)) { var editor = new UITypeEditor(); editor.PaintValue(null, graphics, Rectangle.Empty); editor.PaintValue(new PaintValueEventArgs(null, null, graphics, Rectangle.Empty)); } }
/// <summary> /// Construct a Model. Based on the Type specified the Constructor populate AllowNull, DefaultValue, TypeConverter, StandardValues, StandardValueExclusive /// </summary> /// <param name="p_Type">The type of this model</param> public EditorUITypeEditor(Type p_Type) : base(p_Type) { object l_Editor = System.ComponentModel.TypeDescriptor.GetEditor(p_Type, typeof(System.Drawing.Design.UITypeEditor)); if (l_Editor == null) { throw new MEDDataGridException("Type not valid, no editor associated to this type"); } this.uiTypeEditor = (System.Drawing.Design.UITypeEditor)l_Editor; }
public CursorUI(UITypeEditor host, IWindowsFormsEditorService service, object value) { this.service = service; this.value = value; TypeConverter conv = TypeDescriptor.GetConverter(typeof(Cursor)); foreach (object o in conv.GetStandardValues()) { base.Items.Add(o); } }
public AlignmentUI(UITypeEditor host, IWindowsFormsEditorService service, object value) { this.service = service; this.value = value; base.Items.Add(ContentAlignment.TopLeft); base.Items.Add(ContentAlignment.TopCenter); base.Items.Add(ContentAlignment.TopRight); base.Items.Add(ContentAlignment.MiddleLeft); base.Items.Add(ContentAlignment.MiddleCenter); base.Items.Add(ContentAlignment.MiddleRight); base.Items.Add(ContentAlignment.BottomLeft); base.Items.Add(ContentAlignment.BottomCenter); base.Items.Add(ContentAlignment.BottomRight); }
public AlignmentUI (UITypeEditor host, IWindowsFormsEditorService service, object value) { this.service = service; this.value = value; base.Items.Add (ContentAlignment.TopLeft); base.Items.Add (ContentAlignment.TopCenter); base.Items.Add (ContentAlignment.TopRight); base.Items.Add (ContentAlignment.MiddleLeft); base.Items.Add (ContentAlignment.MiddleCenter); base.Items.Add (ContentAlignment.MiddleRight); base.Items.Add (ContentAlignment.BottomLeft); base.Items.Add (ContentAlignment.BottomCenter); base.Items.Add (ContentAlignment.BottomRight); }
/// <summary> /// Initializes a new instance of <see cref="PopupEditorBindableProperty"/>. /// </summary> /// <param name="property">The underlying <see cref="Property"/> instance.</param> public PopupEditorBindableProperty(Property property) : base(property) { this.property = property; this.popupEditor = property.Attributes .OfType<EditorAttribute>() .Where(x => Type.GetType(x.EditorBaseTypeName, false) == typeof(UITypeEditor)) .Select(x => Type.GetType(x.EditorTypeName)) .Select(x => Activator.CreateInstance(x)) .Cast<UITypeEditor>() .First(); textReadOnly = property.Attributes.OfType<EditorWithReadOnlyTextAttribute>().Where(x => x.ReadonlyText).Any(); }
public CursorUI(UITypeEditor editor) { this.editor = editor; base.Height = 310; this.ItemHeight = Math.Max(4 + Cursors.Default.Size.Height, this.Font.Height); this.DrawMode = DrawMode.OwnerDrawFixed; base.BorderStyle = BorderStyle.None; this.cursorConverter = TypeDescriptor.GetConverter(typeof(Cursor)); if (this.cursorConverter.GetStandardValuesSupported()) { foreach (object obj2 in this.cursorConverter.GetStandardValues()) { base.Items.Add(obj2); } } }
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); }
private object _value; // current editor value #endregion Fields #region Constructors public UITypeEditorControl(UITypeEditor editor, bool allowTyping) { // save ctor parameters _editor = editor; _allowTyping = allowTyping; // initialize combo DropDownStyle = ComboBoxStyle.DropDown; DrawMode = DrawMode.OwnerDrawFixed; // initialize drop down editor _form = new Form(); _form.StartPosition = FormStartPosition.Manual; _form.FormBorderStyle = FormBorderStyle.None; _form.ShowInTaskbar = false; _form.TopLevel = true; _form.Deactivate += new EventHandler(_form_Deactivate); }
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); } }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { object obj; UIService = (System.Windows.Forms.Design.IUIService)provider.GetService(typeof(System.Windows.Forms.Design.IUIService)); try { System.Drawing.Design.UITypeEditor uitypeEditor = (System.Drawing.Design.UITypeEditor)System.ComponentModel.TypeDescriptor.GetEditor(typeof(System.Drawing.Image), typeof(System.Drawing.Design.UITypeEditor)); if (uitypeEditor.GetType().FullName.StartsWith("Microsoft.VisualStudio")) { return(EditValueResourcePicker(uitypeEditor, context, provider, value)); } return(EditValueOpenDialog(value)); } catch (System.Exception e) { UIService.ShowError(e); } return(value); }
public CursorUI(UITypeEditor editor) { this.editor = editor; Height = 310; ItemHeight = (int)Math.Max(4 + Cursors.Default.Size.Height, Font.Height); DrawMode = DrawMode.OwnerDrawFixed; BorderStyle = BorderStyle.None; cursorConverter = TypeDescriptor.GetConverter(typeof(Cursor)); Debug.Assert(cursorConverter.GetStandardValuesSupported(), "Converter '" + cursorConverter.ToString() + "' does not support a list of standard values. We cannot provide a drop-down"); // Fill the list with cursors. // if (cursorConverter.GetStandardValuesSupported()) { foreach (object obj in cursorConverter.GetStandardValues()) { Items.Add(obj); } } }
/// <summary> /// Constructor /// </summary> /// <param name="type">The Type of object that can be edited by this control.</param> protected PickerBase(Type type) { base.SetStyle(ControlStyles.Selectable, true); base.SetStyle(ControlStyles.FixedHeight, true); base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); base.ResizeRedraw = true; paintValueOnly = false; paintValueFrame = true; paintValueWidth = 20; textEditable = true; autoCompletion = true; dropDownCommit = false; editingText = false; editedType = type; typeEditor = null; typeConverter = null; typeContext = null; parseMethod = null; editedValue = null; base.SuspendLayout(); base.CausesValidation = true; pickerButton = new PickerButton(this); pickerValueBox = new PickerValueBox(this); pickerTextBox = new TextBox(); pickerListBox = new PickerListBox(this); pickerService = new PickerService(this); // pickerButton pickerButton.Visible = true; pickerButton.Cursor = Cursors.Default; pickerButton.MouseDown += new MouseEventHandler(pickerButton_MouseDown); pickerButton.MouseUp += new MouseEventHandler(pickerButton_MouseUp); // pickerValueBox pickerValueBox.Visible = false; pickerValueBox.Cursor = Cursors.Default; pickerValueBox.MouseDown += new MouseEventHandler(pickerValueBox_MouseDown); // pickerTextBox pickerTextBox.AcceptsReturn = false; pickerTextBox.AcceptsTab = false; pickerTextBox.CausesValidation = false; pickerTextBox.BorderStyle = BorderStyle.None; pickerTextBox.KeyDown += new KeyEventHandler(pickerTextBox_KeyDown); pickerTextBox.KeyPress += new KeyPressEventHandler(pickerTextBox_KeyPress); pickerTextBox.KeyUp += new KeyEventHandler(pickerTextBox_KeyUp); pickerTextBox.TextChanged += new EventHandler(pickerTextBox_TextChanged); pickerTextBox.GotFocus += new EventHandler(pickerTextBox_GotFocus); pickerTextBox.LostFocus += new EventHandler(pickerTextBox_LostFocus); pickerTextBox.Validating += new CancelEventHandler(pickerTextBox_Validating); pickerTextBox.Validated += new EventHandler(pickerTextBox_Validated); // pickerListBox pickerListBox.Visible = true; pickerListBox.MouseUp += new MouseEventHandler(pickerListBox_MouseUp); pickerListBox.SelectedIndexChanged += new EventHandler(pickerListBox_SelectedIndexChanged); // pickerBase BackColor = SystemColors.Window; ForeColor = SystemColors.WindowText; base.Controls.Add(pickerButton); base.Controls.Add(pickerValueBox); base.Controls.Add(pickerTextBox); base.ResumeLayout(); }
protected override void OnPropertyTaskItemUpdated(System.Windows.Forms.ToolTip toolTip, ref int currentTabIndex) { this._editor = (UITypeEditor) base.PropertyDescriptor.GetEditor(typeof(UITypeEditor)); base.OnPropertyTaskItemUpdated(toolTip, ref currentTabIndex); if (this._editor != null) { this._button.Ellipsis = this._editor.GetEditStyle(base.TypeDescriptorContext) == UITypeEditorEditStyle.Modal; this._hasSwatch = this._editor.GetPaintValueSupported(base.TypeDescriptorContext); } else { this._button.Ellipsis = false; } if (this._button.Ellipsis) { base.EditControl.AccessibleRole = this.IsReadOnly() ? AccessibleRole.StaticText : AccessibleRole.Text; } else { base.EditControl.AccessibleRole = this.IsReadOnly() ? AccessibleRole.DropList : AccessibleRole.ComboBox; } this._button.TabStop = this._button.Ellipsis; this._button.TabIndex = currentTabIndex++; this._button.AccessibleRole = this._button.Ellipsis ? AccessibleRole.PushButton : AccessibleRole.ButtonDropDown; this._button.AccessibleDescription = base.EditControl.AccessibleDescription; this._button.AccessibleName = base.EditControl.AccessibleName; }
/// <include file='doc\COM2AboutBoxPropertyDescriptor.uex' path='docs/doc[@for="Com2AboutBoxPropertyDescriptor.GetEditor"]/*' /> /// <devdoc> /// Retrieves an editor of the requested type. /// </devdoc> public override object GetEditor(Type editorBaseType) { if (editorBaseType == typeof(UITypeEditor)) { if (editor == null) { editor = new AboutBoxUITypeEditor(); } } return editor; }
public UITypeEditorProxy(UITypeEditor uiTypeEditor, object actualInstance) { this.actualInstance = actualInstance; this.uiTypeEditor = uiTypeEditor; }
public void UITypeEditor_Ctor_Default() { var editor = new UITypeEditor(); Assert.False(editor.IsDropDownResizable); }
public Com2PropertyBuilderUITypeEditor(Com2PropertyDescriptor pd, string guidString, int type, UITypeEditor baseEditor) : base(baseEditor) { propDesc = pd; this.guidString = guidString; this.bldrType = type; }
/// <summary> /// Creates a new drop-down control to display the given UITypeEditor /// </summary> protected internal TreeGridDesignerInPlaceEditDropDown( UITypeEditor editor, PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editStyle) : base(editor, propertyDescriptor, instance, editStyle) { }
public Com2ExtendedUITypeEditor(UITypeEditor baseTypeEditor) { innerEditor = baseTypeEditor; }
protected virtual void Dispose(bool disposing) { // make sure we don't accidentally // check flags in this state... flags |= FL_CHECKED; SetFlag(FLAG_DISPOSED, true); cacheItems = null; converter = null; editor = null; accessibleObject = null; if (disposing) { DisposeChildren(); } }
/// <summary> /// Creates a new drop-down control to display the given UITypeEditor /// </summary> protected internal TreeGridDesignerInPlaceEditDropDown(UITypeEditor editor, PropertyDescriptor propertyDescriptor, object instance) : base(editor, propertyDescriptor, instance) { }
protected virtual void Dispose(bool disposing) { this.flags |= -2147483648; this.SetFlag(0x2000, true); this.cacheItems = null; this.converter = null; this.editor = null; this.accessibleObject = null; if (disposing) { this.DisposeChildren(); } }
internal override bool NotifyValueGivenParent(object obj, int type) { if (obj is ICustomTypeDescriptor) { obj = ((ICustomTypeDescriptor)obj).GetPropertyOwner(propertyInfo); } switch (type) { case NOTIFY_RESET: SetPropertyValue(obj, null, true, SR.GetString(SR.PropertyGridResetValue, this.PropertyName)); if (pvUIItems != null) { for (int i = 0; i < pvUIItems.Length; i++) { pvUIItems[i].Reset(); } } pvUIItems = null; return false; case NOTIFY_CAN_RESET: try { return propertyInfo.CanResetValue(obj) || (pvUIItems != null && pvUIItems.Length > 0); } catch { if (this.exceptionConverter == null) { // clear the flags this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } return false; } case NOTIFY_SHOULD_PERSIST: try{ return propertyInfo.ShouldSerializeValue(obj); } catch { if (this.exceptionConverter == null) { // clear the flags this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } return false; } case NOTIFY_DBL_CLICK: case NOTIFY_RETURN: if (eventBindings == null) { eventBindings = (IEventBindingService)GetService(typeof(IEventBindingService)); } if (eventBindings != null) { EventDescriptor descriptor = eventBindings.GetEvent(propertyInfo); if (descriptor != null) { return ViewEvent(obj, null, null, true); } } break; } return false; }
/// <summary> /// Initializes a new instance of the <see cref="NuGenImageIndexEditor"/> class. /// </summary> public NuGenImageIndexEditor() { _parentImageListProperty = "Parent"; _imageEditor = (UITypeEditor)TypeDescriptor.GetEditor(typeof(Image), typeof(UITypeEditor)); }
internal override bool NotifyValueGivenParent(object obj, int type) { bool flag; if (obj is ICustomTypeDescriptor) { obj = ((ICustomTypeDescriptor) obj).GetPropertyOwner(this.propertyInfo); } switch (type) { case 1: this.SetPropertyValue(obj, null, true, System.Windows.Forms.SR.GetString("PropertyGridResetValue", new object[] { this.PropertyName })); if (this.pvUIItems != null) { for (int i = 0; i < this.pvUIItems.Length; i++) { this.pvUIItems[i].Reset(); } } break; case 2: try { return (this.propertyInfo.CanResetValue(obj) || ((this.pvUIItems != null) && (this.pvUIItems.Length > 0))); } catch { if (this.exceptionConverter == null) { this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } return false; } goto Label_00F1; case 3: case 5: if (this.eventBindings == null) { this.eventBindings = (IEventBindingService) this.GetService(typeof(IEventBindingService)); } if ((this.eventBindings != null) && (this.eventBindings.GetEvent(this.propertyInfo) != null)) { return this.ViewEvent(obj, null, null, true); } goto Label_0175; case 4: goto Label_00F1; default: goto Label_0175; } this.pvUIItems = null; return false; Label_00F1: try { flag = this.propertyInfo.ShouldSerializeValue(obj); } catch { if (this.exceptionConverter == null) { this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } flag = false; } return flag; Label_0175: return false; }
private void SetFlagsAndExceptionInfo(int flags, ExceptionConverter converter, ExceptionEditor editor) { this.Flags = flags; this.exceptionConverter = converter; this.exceptionEditor = editor; }
/// <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 OnScreenTypeEditorHost(UITypeEditor editor, PropertyDescriptor propertyDescriptor, object instance) : base(editor, propertyDescriptor, instance) { }
internal void UpdateTypeConverterAndTypeEditorInternal(bool force, int dispid) { if ((!this.GetFlag(1) || force) && (this.owner.GetOcx() != null)) { try { System.Windows.Forms.NativeMethods.IPerPropertyBrowsing perPropertyBrowsing = this.owner.GetPerPropertyBrowsing(); if (perPropertyBrowsing != null) { bool flag = false; System.Windows.Forms.NativeMethods.CA_STRUCT pCaStringsOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); System.Windows.Forms.NativeMethods.CA_STRUCT pCaCookiesOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); int errorCode = 0; try { errorCode = perPropertyBrowsing.GetPredefinedStrings(dispid, pCaStringsOut, pCaCookiesOut); } catch (ExternalException exception) { errorCode = exception.ErrorCode; } if (errorCode != 0) { flag = false; if (this.converter is Com2EnumConverter) { this.converter = null; } } else { flag = true; } if (flag) { OleStrCAMarshaler names = new OleStrCAMarshaler(pCaStringsOut); Int32CAMarshaler values = new Int32CAMarshaler(pCaCookiesOut); if ((names.Count > 0) && (values.Count > 0)) { if (this.converter == null) { this.converter = new AxHost.AxEnumConverter(this, new AxHost.AxPerPropertyBrowsingEnum(this, this.owner, names, values, true)); } else if (this.converter is AxHost.AxEnumConverter) { ((AxHost.AxEnumConverter) this.converter).RefreshValues(); AxHost.AxPerPropertyBrowsingEnum enum2 = ((AxHost.AxEnumConverter) this.converter).com2Enum as AxHost.AxPerPropertyBrowsingEnum; if (enum2 != null) { enum2.RefreshArrays(names, values); } } } } else if (((ComAliasNameAttribute) this.baseProp.Attributes[typeof(ComAliasNameAttribute)]) == null) { Guid propertyPage = this.GetPropertyPage(dispid); if (!Guid.Empty.Equals(propertyPage)) { this.editor = new AxHost.AxPropertyTypeEditor(this, propertyPage); if (!this.IsBrowsable) { this.AddAttribute(new BrowsableAttribute(true)); } } } } this.SetFlag(1, true); } catch (Exception) { } } }
/// <summary> /// Creates a new TypeEditorHost to display the given UITypeEditor /// </summary> /// <param name="editor">The UITypeEditor instance to host</param> /// <param name="editControlStyle">The type of control to show in the edit area.</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 OnScreenTypeEditorHost(UITypeEditor editor, PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editControlStyle) : base(editor, propertyDescriptor, instance, editControlStyle) { }
internal override bool NotifyValueGivenParent(object obj, int type) { bool flag; if (obj is ICustomTypeDescriptor) { obj = ((ICustomTypeDescriptor)obj).GetPropertyOwner(this.propertyInfo); } switch (type) { case 1: this.SetPropertyValue(obj, null, true, System.Windows.Forms.SR.GetString("PropertyGridResetValue", new object[] { this.PropertyName })); if (this.pvUIItems != null) { for (int i = 0; i < this.pvUIItems.Length; i++) { this.pvUIItems[i].Reset(); } } break; case 2: try { return(this.propertyInfo.CanResetValue(obj) || ((this.pvUIItems != null) && (this.pvUIItems.Length > 0))); } catch { if (this.exceptionConverter == null) { this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } return(false); } goto Label_00F1; case 3: case 5: if (this.eventBindings == null) { this.eventBindings = (IEventBindingService)this.GetService(typeof(IEventBindingService)); } if ((this.eventBindings != null) && (this.eventBindings.GetEvent(this.propertyInfo) != null)) { return(this.ViewEvent(obj, null, null, true)); } goto Label_0175; case 4: goto Label_00F1; default: goto Label_0175; } this.pvUIItems = null; return(false); Label_00F1: try { flag = this.propertyInfo.ShouldSerializeValue(obj); } catch { if (this.exceptionConverter == null) { this.Flags = 0; this.exceptionConverter = new ExceptionConverter(); this.exceptionEditor = new ExceptionEditor(); } flag = false; } return(flag); Label_0175: return(false); }
/// <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); } }
private void OnUITypeEditorChanged(UITypeEditor oldValue, UITypeEditor newValue) { OnPropertyChanged(new PropertyChangedEventArgs("UITypeEditor")); }
public Com2ExtendedUITypeEditor(Type baseType) { innerEditor = (UITypeEditor)TypeDescriptor.GetEditor(baseType, typeof(UITypeEditor)); }
/// <devdoc> /// Called externally to update the editor or type converter. /// This simply sets flags so this will happen, it doesn't actually to the update... /// we wait and do that on-demand for perf. /// </devdoc> internal void UpdateTypeConverterAndTypeEditorInternal(bool force, int dispid) { // check to see if we're being forced here or if the work really // needs to be done. // if (GetFlag(FlagUpdatedEditorAndConverter) && !force) { return; } if (owner.GetOcx() == null) { return; } try { NativeMethods.IPerPropertyBrowsing ppb = owner.GetPerPropertyBrowsing(); if (ppb != null) { bool hasStrings = false; // check for enums NativeMethods.CA_STRUCT caStrings = new NativeMethods.CA_STRUCT(); NativeMethods.CA_STRUCT caCookies = new NativeMethods.CA_STRUCT(); int hr = NativeMethods.S_OK; try { hr = ppb.GetPredefinedStrings(dispid, caStrings, caCookies); } catch(ExternalException ex) { hr = ex.ErrorCode; Debug.Fail("An exception occurred inside IPerPropertyBrowsing::GetPredefinedStrings(dispid=" + dispid + "), object type=" + new ComNativeDescriptor().GetClassName(ppb)); } if (hr != NativeMethods.S_OK) { hasStrings = false; // Destroy the existing editor if we created the current one // so if the items have disappeared, we don't hold onto the old // items. if (converter is Com2EnumConverter) { converter = null; } } else { hasStrings = true; } if (hasStrings) { OleStrCAMarshaler stringMarshaler = new OleStrCAMarshaler(caStrings); Int32CAMarshaler intMarshaler = new Int32CAMarshaler(caCookies); if (stringMarshaler.Count > 0 && intMarshaler.Count > 0) { if (converter == null) { converter = new AxEnumConverter(this, new AxPerPropertyBrowsingEnum(this, owner, stringMarshaler, intMarshaler, true)); } else if (converter is AxEnumConverter){ ((AxEnumConverter)converter).RefreshValues(); AxPerPropertyBrowsingEnum axEnum = ((AxEnumConverter)converter).com2Enum as AxPerPropertyBrowsingEnum; if (axEnum != null) { axEnum.RefreshArrays(stringMarshaler, intMarshaler); } } } else { //hasStrings = false; } } else { // if we didn't get any strings, try the proppage edtior // // Check to see if this is a property that we have already massaged to be a // .Net type. If it is, don't bother with custom property pages. We already // have a .Net Editor for this type. // ComAliasNameAttribute comAlias = (ComAliasNameAttribute)baseProp.Attributes[typeof(ComAliasNameAttribute)]; if (comAlias == null) { Guid g = GetPropertyPage(dispid); if (!Guid.Empty.Equals(g)) { editor = new AxPropertyTypeEditor(this, g); // Show any non-browsable property that has an editor through a // property page. // if (!this.IsBrowsable) { Debug.WriteLineIf(AxPropTraceSwitch.TraceVerbose, "Making property: " + this.Name + " browsable because we found an editor."); AddAttribute(new BrowsableAttribute(true)); } } } } } SetFlag(FlagUpdatedEditorAndConverter, true); } catch (Exception e) { Debug.WriteLineIf(AxPropTraceSwitch.TraceVerbose, "could not get the type editor for property: " + this.Name + " Exception: " + e); } }
public Com2PropertyPageUITypeEditor(Com2PropertyDescriptor pd, Guid guid, UITypeEditor baseEditor) : base(baseEditor) { this.propDesc = pd; this.guid = guid; }
public PropInPlaceUITypeEditor(UITypeEditor _editor, bool editable) { this._editor = _editor; if (editable) { _edit = new PropInPlaceTextbox(false); _edit.Parent = this; _edit.Text = Text; _edit.TabStop = false; } _editorService = new EditorService(this); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | Utilities.DoubleBufferStyle | ControlStyles.Opaque | ControlStyles.ResizeRedraw, true); Cursor = Cursors.Arrow; }