/// <summary> /// Initializes a new instance of <c>BrushPainter2EditorDialog</c> using an existing <c>BrushPainter2</c> /// at the default window position. /// </summary> /// <param name="filler">Existing <c>BrushPainter2</c> object.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="filler" /> is null. /// </exception> public BrushPainter2EditorDialog(BrushPainter2 filler) { if (filler == null) { throw new ArgumentNullException("filler"); } InitializeComponent(); AdjustDialogSize(); SetControlsToInitialValues(filler); }
private void okButton_Click(object sender, EventArgs e) { if (solidRadioButton.Checked) { filler = new BrushPainter2(FromLabelNud(solidColorLabel, solidAlphaNud)); } else if (hatchRadioButton.Checked) { filler = new BrushPainter2(hatchComboBox.SelectedHatchStyle, FromLabelNud(hatchColorLabel, hatchAlphaNud), FromLabelNud(backColorLabel, backAlphaNud)); } else if (gradientRadioButton.Checked) { filler = new BrushPainter2(gradientEditor.Blend); } else { filler = BrushPainter2.Empty(); } DialogResult = DialogResult.OK; }
private void SetControlsToInitialValues(BrushPainter2 filler) { Init(filler.SolidColor, solidColorLabel, solidAlphaNud); Init(filler.HatchColor, hatchColorLabel, hatchAlphaNud); Init(filler.BackColor, backColorLabel, backAlphaNud); gradientEditor.Blend = filler.GradientColors; hatchComboBox.SelectedIndex = 0; for (int i = 0; i < hatchComboBox.Items.Count; i++) { if (filler.HatchStyle == (HatchStyle)(hatchComboBox.Items[i])) { hatchComboBox.SelectedIndex = i; } } UpdateHatch(); UpdateSolid(); if (filler.FillType == BrushPainter2Type.None) { noneRadioButton.Checked = true; } else if (filler.FillType == BrushPainter2Type.Solid) { solidRadioButton.Checked = true; } else if (filler.FillType == BrushPainter2Type.Hatch) { hatchRadioButton.Checked = true; } else { gradientRadioButton.Checked = true; } }
/// <summary> /// Initializes a new instance of <c>BrushPainter2EditorDialog</c> using an existing <c>BrushPainter2</c> /// and positioned beneath the specified control. /// </summary> /// <param name="filler">Existing <c>BrushPainter2</c> object.</param> /// <param name="c">Control beneath which the dialog should be placed.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="filler" /> is null. /// </exception> public BrushPainter2EditorDialog(BrushPainter2 filler, Control c) : this(filler) { Utils.SetStartPositionBelowControl(this, c); }
/// <summary> /// Initializes a new instance of <c>BrushPainter2EditorDialog</c> using an empty <c>BrushPainter2</c> /// and positioned beneath the specified control. /// </summary> /// <param name="c">Control beneath which the dialog should be placed.</param> public BrushPainter2EditorDialog(Control c) : this(BrushPainter2.Empty(), c) { }
/// <summary> /// Initializes a new instance of <c>BrushPainter2EditorDialog</c> using an empty <c>BrushPainter2</c> /// at the default window position. /// </summary> public BrushPainter2EditorDialog() : this(BrushPainter2.Empty()) { }