Beispiel #1
0
        private void _btnOk_Click(object sender, System.EventArgs e)
        {
            // Run the command depending on the checked flags in the dialog
            Flags = HolePunchRemoveCommandFlags.None;

            if (_cbImageUnchanged.Checked)
            {
                Flags |= HolePunchRemoveCommandFlags.ImageUnchanged;
            }
            if (_cbUseCount.Checked)
            {
                Flags |= HolePunchRemoveCommandFlags.UseCount;
            }
            if (_cbUseLocation.Checked)
            {
                Flags |= HolePunchRemoveCommandFlags.UseLocation;
            }
            if (_cbUseDpi.Checked)
            {
                Flags |= HolePunchRemoveCommandFlags.UseDpi;
            }
            if (_cbUseSize.Checked)
            {
                Flags |= HolePunchRemoveCommandFlags.UseSize;
            }

            if (_rbButtonLeft.Checked)
            {
                HoleLocation = HolePunchRemoveCommandLocation.Left;
            }
            if (_rbButtonTop.Checked)
            {
                HoleLocation = HolePunchRemoveCommandLocation.Top;
            }
            if (_rbButtonRight.Checked)
            {
                HoleLocation = HolePunchRemoveCommandLocation.Right;
            }
            if (_rbButtonBottom.Checked)
            {
                HoleLocation = HolePunchRemoveCommandLocation.Bottom;
            }

            MinCount  = (int)_numMinCount.Value;
            MaxCount  = (int)_numMaxCount.Value;
            MinWidth  = (int)_numMinWidth.Value;
            MinHeight = (int)_numMinHeight.Value;
            MaxWidth  = (int)_numMaxWidth.Value;
            MaxHeight = (int)_numMaxHeight.Value;

            _initialFlags        = Flags;
            _initialHoleLocation = HoleLocation;
            _initialMinCount     = MinCount;
            _initialMaxCount     = MaxCount;
            _initialMinWidth     = MinWidth;
            _initialMinHeight    = MinHeight;
            _initialMaxWidth     = MaxWidth;
            _initialMaxHeight    = MaxHeight;
        }
        private void HolePunchRemoveDialog_Load(object sender, System.EventArgs e)
        {
            if (_firstTimer)
            {
                _firstTimer = false;
                HolePunchRemoveCommand command = new HolePunchRemoveCommand();
                _initialFlags        = command.Flags;
                _initialHoleLocation = command.Location;
                _initialMinCount     = command.MinimumHoleCount;
                _initialMaxCount     = command.MaximumHoleCount;
                _initialMinWidth     = command.MinimumHoleWidth;
                _initialMinHeight    = command.MinimumHoleHeight;
                _initialMaxWidth     = command.MaximumHoleWidth;
                _initialMaxHeight    = command.MaximumHoleHeight;
            }

            Flags        = _initialFlags;
            HoleLocation = _initialHoleLocation;
            MinCount     = _initialMinCount;
            MaxCount     = _initialMaxCount;
            MinWidth     = _initialMinWidth;
            MinHeight    = _initialMinHeight;
            MaxWidth     = _initialMaxWidth;
            MaxHeight    = _initialMaxHeight;

            _cbImageUnchanged.Checked = (Flags & HolePunchRemoveCommandFlags.ImageUnchanged) == HolePunchRemoveCommandFlags.ImageUnchanged;
            _cbUseCount.Checked       = (Flags & HolePunchRemoveCommandFlags.UseCount) == HolePunchRemoveCommandFlags.UseCount;
            _cbUseLocation.Checked    = (Flags & HolePunchRemoveCommandFlags.UseLocation) == HolePunchRemoveCommandFlags.UseLocation;
            _cbUseDpi.Checked         = (Flags & HolePunchRemoveCommandFlags.UseDpi) == HolePunchRemoveCommandFlags.UseDpi;
            _cbUseSize.Checked        = (Flags & HolePunchRemoveCommandFlags.UseSize) == HolePunchRemoveCommandFlags.UseSize;

            _rbButtonLeft.Checked   = HoleLocation == HolePunchRemoveCommandLocation.Left;
            _rbButtonTop.Checked    = HoleLocation == HolePunchRemoveCommandLocation.Top;
            _rbButtonRight.Checked  = HoleLocation == HolePunchRemoveCommandLocation.Right;
            _rbButtonBottom.Checked = HoleLocation == HolePunchRemoveCommandLocation.Bottom;

            _numMinCount.Value  = MinCount;
            _numMaxCount.Value  = MaxCount;
            _numMinWidth.Value  = MinWidth;
            _numMinHeight.Value = MinHeight;
            _numMaxWidth.Value  = MaxWidth;
            _numMaxHeight.Value = MaxHeight;

            UpdateControls();
        }