private void BorderRemoveDialog_Load(object sender, System.EventArgs e) { if (_firstTimer) { _firstTimer = false; BorderRemoveCommand command = new BorderRemoveCommand(); _initialFlags = command.Flags; _initialBorder = command.Border; _initialPercent = command.Percent; _initialVariance = command.Variance; _initialWhiteNoiseLength = command.WhiteNoiseLength; } Flags = _initialFlags; Border = _initialBorder; Percent = _initialPercent; Variance = _initialVariance; WhiteNoiseLength = _initialWhiteNoiseLength; _cbAutoRemove.Checked = (Flags & BorderRemoveCommandFlags.AutoRemove) == BorderRemoveCommandFlags.AutoRemove; _cbImageUnchanged.Checked = (Flags & BorderRemoveCommandFlags.ImageUnchanged) == BorderRemoveCommandFlags.ImageUnchanged; _cbUseVariance.Checked = (Flags & BorderRemoveCommandFlags.UseVariance) == BorderRemoveCommandFlags.UseVariance; _cbLeft.Checked = (Border & BorderRemoveBorderFlags.Left) == BorderRemoveBorderFlags.Left; _cbTop.Checked = (Border & BorderRemoveBorderFlags.Top) == BorderRemoveBorderFlags.Top; _cbRight.Checked = (Border & BorderRemoveBorderFlags.Right) == BorderRemoveBorderFlags.Right; _cbBottom.Checked = (Border & BorderRemoveBorderFlags.Bottom) == BorderRemoveBorderFlags.Bottom; _numPercent.Value = Percent; _numVariance.Value = Variance; _numWhiteNoiseLength.Value = WhiteNoiseLength; UpdateControls(); }
private void _btnOk_Click(object sender, System.EventArgs e) { Flags = BorderRemoveCommandFlags.None; if (_cbAutoRemove.Checked) { Flags = BorderRemoveCommandFlags.AutoRemove; } else { if (_cbImageUnchanged.Checked) { Flags |= BorderRemoveCommandFlags.ImageUnchanged; } if (_cbUseVariance.Checked) { Flags |= BorderRemoveCommandFlags.UseVariance; } } Border = BorderRemoveBorderFlags.None; if (_cbLeft.Checked) { Border |= BorderRemoveBorderFlags.Left; } if (_cbTop.Checked) { Border |= BorderRemoveBorderFlags.Top; } if (_cbRight.Checked) { Border |= BorderRemoveBorderFlags.Right; } if (_cbBottom.Checked) { Border |= BorderRemoveBorderFlags.Bottom; } Percent = (int)_numPercent.Value; Variance = (int)_numVariance.Value; WhiteNoiseLength = (int)_numWhiteNoiseLength.Value; _initialFlags = Flags; _initialBorder = Border; _initialPercent = Percent; _initialVariance = Variance; _initialWhiteNoiseLength = WhiteNoiseLength; }