Example #1
0
        /// <summary>
        /// Internal event raised when a change occurs in the selected region.
        /// </summary>
        /// <param name="regionBounds">Region bounds.</param>
        protected virtual void OnRegionSet(ThumbnailRegion region)
        {
            //Forward region to thumbnail
            ParentMainForm.SelectedThumbnailRegion = region;

            //Have region, allowed to save
            buttonSave.Enabled = true;
        }
Example #2
0
        /// <summary>
        /// Constructs a ThumbnailRegion from the dialog's current state.
        /// </summary>
        protected ThumbnailRegion ConstructCurrentRegion()
        {
            Rectangle bounds = new Rectangle {
                X      = (int)numX.Value,
                Y      = (int)numY.Value,
                Width  = (int)numW.Value,
                Height = (int)numH.Value
            };

            ThumbnailRegion newRegion = new ThumbnailRegion(bounds, checkRelative.Checked);

            return(newRegion);
        }
Example #3
0
        /// <summary>
        /// Sets the current selected region to a specific region rectangle.
        /// </summary>
        /// <param name="region">The region boundaries.</param>
        public void SetRegion(ThumbnailRegion region)
        {
            try {
                _ignoreValueChanges = true;

                UpdateRegionControls(region);

                numX.Enabled = numY.Enabled = numW.Enabled = numH.Enabled = true;
            }
            finally {
                _ignoreValueChanges = false;
            }

            OnRegionSet(region);
        }
Example #4
0
        /// <summary>
        /// Updates the labels for the region value selectors and the relative mode checkbox.
        /// </summary>
        private void UpdateRegionControls(ThumbnailRegion region)
        {
            checkRelative.Checked = region.Relative;

            if (region.Relative)
            {
                Padding p = region.BoundsAsPadding;
                numX.Value = p.Left;
                numY.Value = p.Top;
                numW.Value = p.Right;
                numH.Value = p.Bottom;
            }
            else
            {
                Rectangle r = region.Bounds;
                numX.Value = r.X;
                numY.Value = r.Y;
                numW.Value = r.Width;
                numH.Value = r.Height;
            }

            UpdateRegionLabels();
        }
Example #5
0
 void ThumbnailPanel_RegionDrawn(object sender, ThumbnailRegion region)
 {
     SetRegion(region);
 }
Example #6
0
        /// <summary>
        /// Updates the labels for the region value selectors and the relative mode checkbox.
        /// </summary>
        private void UpdateRegionControls(ThumbnailRegion region)
        {
            checkRelative.Checked = region.Relative;

            if (region.Relative) {
                Padding p = region.BoundsAsPadding;
                numX.Value = p.Left;
                numY.Value = p.Top;
                numW.Value = p.Right;
                numH.Value = p.Bottom;
            }
            else {
                Rectangle r = region.Bounds;
                numX.Value = r.X;
                numY.Value = r.Y;
                numW.Value = r.Width;
                numH.Value = r.Height;
            }

            UpdateRegionLabels();
        }
Example #7
0
 void ThumbnailPanel_RegionDrawn(object sender, ThumbnailRegion region)
 {
     SetRegion(region);
 }
Example #8
0
        /// <summary>
        /// Internal event raised when a change occurs in the selected region.
        /// </summary>
        /// <param name="regionBounds">Region bounds.</param>
        protected virtual void OnRegionSet(ThumbnailRegion region)
        {
            //Forward region to thumbnail
            ParentMainForm.SelectedThumbnailRegion = region;

            //Have region, allowed to save
            buttonSave.Enabled = true;
        }
Example #9
0
        /// <summary>
        /// Constructs a ThumbnailRegion from the dialog's current state.
        /// </summary>
        protected ThumbnailRegion ConstructCurrentRegion()
        {
            Rectangle bounds = new Rectangle {
                X = (int)numX.Value,
                Y = (int)numY.Value,
                Width = (int)numW.Value,
                Height = (int)numH.Value
            };

            ThumbnailRegion newRegion = new ThumbnailRegion(bounds, checkRelative.Checked);

            return newRegion;
        }
Example #10
0
        /// <summary>
        /// Sets the current selected region to a specific region rectangle.
        /// </summary>
        /// <param name="region">The region boundaries.</param>
        public void SetRegion(ThumbnailRegion region)
        {
            try {
                _ignoreValueChanges = true;

                UpdateRegionControls(region);

                numX.Enabled = numY.Enabled = numW.Enabled = numH.Enabled = true;
            }
            finally {
                _ignoreValueChanges = false;
            }

            OnRegionSet(region);
        }