Пример #1
0
        /// <summary>
        /// Constructs a new NewColorRampForm class.
        /// </summary>
        public ColorRampForm(ColorRampEditor editor, string key)
        {
            this.editor = editor;

            InitializeComponent();
            if (key != null && ColorRampConverter.ColorRampList.ContainsKey(key))
            {
                values              = ColorRampConverter.ColorRampList[key];
                this.Text           = "Edit Colour Ramp";
                textBoxName.Text    = key;
                textBoxName.Enabled = false;
                if (values.ContainsKey(0))
                {
                    colorPickerStart.Value = values[0];
                }
                if (values.ContainsKey(100))
                {
                    colorPickerEnd.Value = values[100];
                }
            }
            else
            {
                values = new ColorRampValueList();
                values.Add(0, colorPickerStart.Value);
                values.Add(100, colorPickerEnd.Value);
            }

            comboBoxStyle.DataSource   = Enum.GetValues(typeof(ColorRampStyle));
            comboBoxStyle.SelectedItem = ColorRampStyle.Gradient;
            UpdateState();
            UpdatePreview();
        }
Пример #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ColorRampPicker()
     : base(typeof(ColorRampValueList))
 {
     TextEditable    = false;
     PaintValueFrame = false;
     PaintValueWidth = 40;
     Editor          = new ColorRampEditor();
     Converter       = new ColorRampConverter();
     Value           = (ColorRampValueList)Converter.ConvertFrom("Random values");
 }