public override void PaintValue(PaintValueEventArgs e) { Graphics g = e.Graphics; GradientInfo gradient = (GradientInfo)e.Value; gradient.Draw(g, e.Bounds); g.DrawRectangleProper(Pens.Black, e.Bounds); }
public GradientPickerForm(GradientInfo gradient) { Gradient = gradient; InitializeComponent(); Icon = ShareXResources.Icon; cbGradientType.Items.AddRange(Helpers.GetEnumNamesProper<LinearGradientMode>()); cbGradientType.SelectedIndex = (int)Gradient.Type; foreach (GradientStop gradientStop in Gradient.Colors) { AddGradientStop(gradientStop); } isReady = true; UpdatePreview(); }
public GradientPickerForm(GradientInfo gradient) { Gradient = gradient; InitializeComponent(); Icon = ShareXResources.Icon; cbGradientType.Items.AddRange(Helpers.GetEnumNamesProper <LinearGradientMode>()); cbGradientType.SelectedIndex = (int)Gradient.Type; foreach (GradientStop gradientStop in Gradient.Colors) { AddGradientStop(gradientStop); } isReady = true; UpdatePreview(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (value.GetType() != typeof(GradientInfo)) { return(value); } IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { GradientInfo gradient = (GradientInfo)value; using (GradientPickerForm form = new GradientPickerForm(gradient.Copy())) { if (svc.ShowDialog(form) == DialogResult.OK) { return(form.Gradient); } } } return(value); }
public DrawText() { this.ApplyDefaultPropertyValues(); Gradient = new GradientInfo(); Gradient.Colors.Add(new GradientStop(Color.FromArgb(68, 120, 194), 0f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(13, 58, 122), 50f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(6, 36, 78), 50f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(12, 76, 159), 100f)); }
private void AddDefaultGradient() { Gradient = new GradientInfo(); Gradient.Colors.Add(new GradientStop(Color.FromArgb(68, 120, 194), 0f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(13, 58, 122), 50f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(6, 36, 78), 50f)); Gradient.Colors.Add(new GradientStop(Color.FromArgb(23, 89, 174), 100f)); }