/// <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; }
/// <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); }
/// <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); }
/// <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(); }
void ThumbnailPanel_RegionDrawn(object sender, ThumbnailRegion region) { SetRegion(region); }
/// <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(); }
void ThumbnailPanel_RegionDrawn(object sender, ThumbnailRegion region) { SetRegion(region); }
/// <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; }
/// <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; }
/// <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); }