public override Object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value) { if (value != typeof(Corners) || provider == null) return value; IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { CheckedListBox lb = new CheckedListBox(); lb.BorderStyle = BorderStyle.None; lb.CheckOnClick = true; lb.Items.Add("TopLeft", (((MyButton)context.Instance).RoundCorners & Corners.TopLeft) == Corners.TopLeft); lb.Items.Add("TopRight", (((MyButton)context.Instance).RoundCorners & Corners.TopRight) == Corners.TopRight); lb.Items.Add("BottomLeft", (((MyButton)context.Instance).RoundCorners & Corners.BottomLeft) == Corners.BottomLeft); lb.Items.Add("BottomRight", (((MyButton)context.Instance).RoundCorners & Corners.BottomRight) == Corners.BottomRight); edSvc.DropDownControl(lb); Corners cornerFlags = Corners.None; foreach (object o in lb.CheckedItems) { cornerFlags = cornerFlags | (Corners)Enum.Parse(typeof(Corners), o.ToString()); } lb.Dispose(); edSvc.CloseDropDown(); return cornerFlags; } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { TrackBarOwnerDrawParts parts = TrackBarOwnerDrawParts.None; if (!(value is TrackBarOwnerDrawParts) || (provider == null)) { return(value); } IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null) { return(value); } CheckedListBox control = new CheckedListBox(); control.BorderStyle = BorderStyle.None; control.CheckOnClick = true; control.Items.Add("Ticks", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks); control.Items.Add("Thumb", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb); control.Items.Add("Channel", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel); service.DropDownControl(control); IEnumerator enumerator = control.CheckedItems.GetEnumerator(); while (enumerator.MoveNext()) { object objectValue = RuntimeHelpers.GetObjectValue(enumerator.Current); parts |= (TrackBarOwnerDrawParts)Enum.Parse(typeof(TrackBarOwnerDrawParts), objectValue.ToString()); } control.Dispose(); service.CloseDropDown(); return(parts); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { TrackBarOwnerDrawParts barOwnerDrawParts = TrackBarOwnerDrawParts.None; if (!(value is TrackBarOwnerDrawParts) || provider == null) { return(value); } IWindowsFormsEditorService formsEditorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (formsEditorService == null) { return(value); } CheckedListBox checkedListBox = new CheckedListBox(); checkedListBox.BorderStyle = BorderStyle.None; checkedListBox.CheckOnClick = true; checkedListBox.Items.Add((object)"Ticks", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks); checkedListBox.Items.Add((object)"Thumb", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb); checkedListBox.Items.Add((object)"Channel", (((FusionTrackBar)context.Instance).OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel); formsEditorService.DropDownControl((Control)checkedListBox); foreach (object obj in checkedListBox.CheckedItems) { object objectValue = RuntimeHelpers.GetObjectValue(obj); barOwnerDrawParts |= (TrackBarOwnerDrawParts)Enum.Parse(typeof(TrackBarOwnerDrawParts), objectValue.ToString()); } checkedListBox.Dispose(); formsEditorService.CloseDropDown(); return((object)barOwnerDrawParts); }
/// <summary> /// Disposes the object. /// </summary> private void Dispose(bool disposing) { if (false == _disposed) { // clean native resources if (disposing) { // clean managed resources _checkedListBox.Dispose(); _popUp.Dispose(); } _disposed = true; } }
public void Dispose() { Console.WriteLine("Disposing renderer"); Loaded = false; InputTimer.Dispose(); meshControl.Dispose(); cameraLabel.Dispose(); fpsLabel.Dispose(); animationBox.Dispose(); cameraBox.Dispose(); if (renderModeComboBox != null) { renderModeComboBox.Dispose(); } }
public void Dispose() { cbx.Dispose(); }