public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { FlashTrackBar trackBar = new FlashTrackBar(); trackBar.ValueChanged += new EventHandler(this.ValueChanged); SetEditorProps((FlashTrackBar)context.Instance, trackBar); bool asInt = true; if (value is int) { trackBar.Value = (int)value; } else if (value is byte) { asInt = false; trackBar.Value = (byte)value; } edSvc.DropDownControl(trackBar); if (asInt) { value = trackBar.Value; } else { value = (byte)trackBar.Value; } } } return(value); }
protected virtual void SetEditorProps(FlashTrackBar editingInstance, FlashTrackBar editor) { editor.ShowValue = true; editor.StartColor = Color.Navy; editor.EndColor = Color.White; editor.ForeColor = Color.White; editor.Min = editingInstance.Min; editor.Max = editingInstance.Max; }
protected override void SetEditorProps(FlashTrackBar editingInstance, FlashTrackBar editor) { base.SetEditorProps(editingInstance, editor); editor.Min = 0; editor.Max = byte.MaxValue; }