Пример #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                edSv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSv != null)
                {
                    FlashTrackerBar trackBar = new FlashTrackerBar();
                    trackBar.ValueChanged += new EventHandler(this.ValueChanged);
                    SetEditorProps((FlashTrackerBar)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;
                    }
                    edSv.DropDownControl(trackBar);
                    if (asInt)
                    {
                        value = trackBar.Value;
                    }
                    else
                    {
                        value = (byte)trackBar.Value;
                    }
                }
            }
            return(value);
        }
Пример #2
0
 protected virtual void SetEditorProps(FlashTrackerBar editingInstance, FlashTrackerBar 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(FlashTrackerBar editingInstance, FlashTrackerBar editor)
 {
     editor.Min = 0;
     editor.Max = byte.MaxValue;
 }