Наследование: Common.Controls.BaseForm
 private void panelGradient_Click(object sender, EventArgs e)
 {
     using (ColorGradientEditor cge = new ColorGradientEditor(ColorGradientValue)) {
         DialogResult result = cge.ShowDialog();
         if (result == DialogResult.OK) {
             ColorGradientValue = cge.Gradient;
         }
     }
 }
Пример #2
0
        public bool EditLibraryItem(string name)
        {
            ColorGradient cg = GetColorGradient(name);

            if (cg == null)
            {
                return(false);
            }

            ColorGradientEditor editor = new ColorGradientEditor(cg, false, null);

            editor.LibraryItemName = name;

            if (editor.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                _RemoveColorGradient(name);
                AddColorGradient(name, editor.Gradient);
                return(true);
            }

            return(false);
        }
Пример #3
0
		public override Object ShowDialog(PropertyItem propertyItem, Object propertyValue, IInputElement commandSource)
		{
			ColorGradient gradient;
			var value = propertyValue as ColorGradient;
			HashSet<Color> discreteColors = GetDiscreteColors(propertyItem.Component);
			if (value != null)
			{
				gradient = value;
			}
			else
			{
				gradient = discreteColors.Any() ? new ColorGradient(discreteColors.First()) : new ColorGradient(Color.White);
			}

			ColorGradientEditor editor = new ColorGradientEditor(gradient, discreteColors.Any(), discreteColors);
			editor.Text = propertyItem.DisplayName;
			if (editor.ShowDialog() == DialogResult.OK)
			{
				propertyValue = editor.Gradient;
			}

			return propertyValue;
		}