private void ApplyProps( ) { if (_btnApply.Enabled) { _categorizedProps = GetProps(); _paintProperties = _categorizedProps.ToPaintProperties(); if (Apply != null) { Apply(this, EventArgs.Empty); } } }
private CategorizedPaintProperties GetProps( ) { CategorizedPaintProperties props = new CategorizedPaintProperties(); if (_cbEngine.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbEngine.SelectedItem; props.PaintEngine = (RasterPaintEngine)item.Value; } if (_cbOperation.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbOperation.SelectedItem; props.RasterOperation = item.Value; } if (_cbDithering.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbDithering.SelectedItem; props.Dithering = (CategorizedDithering)item.Value; } if (_cbPalette.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbPalette.SelectedItem; props.Palette = (CategorizedPalette)item.Value; } if (_cbBitonalScaling.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbBitonalScaling.SelectedItem; props.BitonalScaling = (CategorizedBitonalScaling)item.Value; } if (_cbPaintScaling.SelectedItem != null) { ComboBoxItem item = (ComboBoxItem)_cbPaintScaling.SelectedItem; props.PaintScaling = (CategorizedPaintScaling)item.Value; } props.UsePaintPalette = true; props.IndexedPaint = _cbIndexedPaint.Checked; props.FastPaint = _cbFastPaint.Checked; props.HalftonePrint = _cbHalftonePrint.Checked; return(props); }
private void CheckApply( ) { bool canApply = false; CategorizedPaintProperties props = GetProps(); if (!canApply && props.PaintEngine != _categorizedProps.PaintEngine) { canApply = true; } if (!canApply && props.RasterOperation != _categorizedProps.RasterOperation) { canApply = true; } if (!canApply && props.Dithering != _categorizedProps.Dithering) { canApply = true; } if (!canApply && props.Palette != _categorizedProps.Palette) { canApply = true; } if (!canApply && props.BitonalScaling != _categorizedProps.BitonalScaling) { canApply = true; } if (!canApply && props.PaintScaling != _categorizedProps.PaintScaling) { canApply = true; } if (!canApply && props.UsePaintPalette != _categorizedProps.UsePaintPalette) { canApply = true; } if (!canApply && props.IndexedPaint != _categorizedProps.IndexedPaint) { canApply = true; } if (!canApply && props.FastPaint != _categorizedProps.FastPaint) { canApply = true; } if (!canApply && props.HalftonePrint != _categorizedProps.HalftonePrint) { canApply = true; } _btnApply.Enabled = canApply; _lblOperation.Enabled = props.PaintEngine != RasterPaintEngine.GdiPlus; _cbOperation.Enabled = props.PaintEngine != RasterPaintEngine.GdiPlus; }
private void PaintPropertiesDialog_Load(object sender, System.EventArgs e) { _categorizedProps = new CategorizedPaintProperties(PaintProperties); foreach (ComboBoxItem i in _engines) { _cbEngine.Items.Add(i); if ((RasterPaintEngine)i.Value == _categorizedProps.PaintEngine) { _cbEngine.SelectedItem = i; } } foreach (ComboBoxItem i in _operations) { _cbOperation.Items.Add(i); if (i.Value == _categorizedProps.RasterOperation) { _cbOperation.SelectedItem = i; } } foreach (ComboBoxItem i in _ditherings) { _cbDithering.Items.Add(i); if ((CategorizedDithering)i.Value == _categorizedProps.Dithering) { _cbDithering.SelectedItem = i; } } foreach (ComboBoxItem i in _palettes) { _cbPalette.Items.Add(i); if ((CategorizedPalette)i.Value == _categorizedProps.Palette) { _cbPalette.SelectedItem = i; } } foreach (ComboBoxItem i in _bitonalScalings) { _cbBitonalScaling.Items.Add(i); if ((CategorizedBitonalScaling)i.Value == _categorizedProps.BitonalScaling) { _cbBitonalScaling.SelectedItem = i; } } foreach (ComboBoxItem i in _paintScalings) { _cbPaintScaling.Items.Add(i); if ((CategorizedPaintScaling)i.Value == _categorizedProps.PaintScaling) { _cbPaintScaling.SelectedItem = i; } } _cbIndexedPaint.Checked = _categorizedProps.IndexedPaint; _cbFastPaint.Checked = _categorizedProps.FastPaint; _cbHalftonePrint.Checked = _categorizedProps.HalftonePrint; CheckApply(); }