From b03a8ce896836b9e4c4c66aafe6b01446434ea72 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 26 Mar 2018 10:48:20 +0200 Subject: [PATCH] Fix related to #2853 --- src/Forms/Styles/SubStationAlphaStyles.cs | 12 ++++++++++-- .../Styles/SubStationAlphaStylesBatchConvert.cs | 13 ++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Forms/Styles/SubStationAlphaStyles.cs b/src/Forms/Styles/SubStationAlphaStyles.cs index 320c821af..e5d8f98f1 100644 --- a/src/Forms/Styles/SubStationAlphaStyles.cs +++ b/src/Forms/Styles/SubStationAlphaStyles.cs @@ -467,8 +467,16 @@ namespace Nikse.SubtitleEdit.Forms.Styles else panelOutlineColor.BackColor = style.Outline; panelBackColor.BackColor = style.Background; - numericUpDownOutline.Value = style.OutlineWidth; - numericUpDownShadowWidth.Value = style.ShadowWidth; + + if (style.OutlineWidth >= 0 && style.OutlineWidth <= numericUpDownOutline.Maximum) + numericUpDownOutline.Value = style.OutlineWidth; + else + numericUpDownOutline.Value = 2; + + if (style.ShadowWidth >= 0 && style.ShadowWidth <= numericUpDownShadowWidth.Maximum) + numericUpDownShadowWidth.Value = style.ShadowWidth; + else + numericUpDownShadowWidth.Value = 1; if (_isSubStationAlpha) { diff --git a/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs b/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs index 218e54d8d..62b5937ed 100644 --- a/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs +++ b/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs @@ -2,7 +2,6 @@ using Nikse.SubtitleEdit.Core.SubtitleFormats; using Nikse.SubtitleEdit.Logic; using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; @@ -796,8 +795,16 @@ namespace Nikse.SubtitleEdit.Forms.Styles else panelOutlineColor.BackColor = style.Outline; panelBackColor.BackColor = style.Background; - numericUpDownOutline.Value = style.OutlineWidth; - numericUpDownShadowWidth.Value = style.ShadowWidth; + + if (style.OutlineWidth >= 0 && style.OutlineWidth <= numericUpDownOutline.Maximum) + numericUpDownOutline.Value = style.OutlineWidth; + else + numericUpDownOutline.Value = 2; + + if (style.ShadowWidth >= 0 && style.ShadowWidth <= numericUpDownShadowWidth.Maximum) + numericUpDownShadowWidth.Value = style.ShadowWidth; + else + numericUpDownShadowWidth.Value = 1; if (_isSubStationAlpha) {