Skip to content

Commit 96ba446

Browse files
Fix panel background color (#26)
Co-authored-by: CommonLoon102 <[email protected]>
1 parent b1622f2 commit 96ba446

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

RegexFileSearcher/RegexFileSearcher/MainForm.xeto.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public partial class MainForm : Form
1919

2020
private CancellationTokenSource _cancellationTokenSource;
2121
private Timer _updateTimer;
22+
private Color _defaultPanelBackgroundColor;
2223
private bool _matchNumberOrdering;
2324
private volatile bool _searchEnded = true;
2425

@@ -29,6 +30,7 @@ public MainForm() : this(initializeControls: true)
2930

3031
txtFileNameRegex.TextChanged += OnTextBoxChangedRegex;
3132
txtContentRegex.TextChanged += OnTextBoxChangedRegex;
33+
_defaultPanelBackgroundColor = txtFileNameRegex.Parent.Parent.BackgroundColor;
3234
}
3335

3436
private void OnTextBoxChangedRegex(object sender, EventArgs e)
@@ -37,11 +39,11 @@ private void OnTextBoxChangedRegex(object sender, EventArgs e)
3739
bool isContentRegexValid = ValidateRegex(txtContentRegex);
3840
btnStartSearch.Enabled = isFileNameRegexValid && isContentRegexValid;
3941

40-
static bool ValidateRegex(TextBox textBox)
42+
bool ValidateRegex(TextBox textBox)
4143
{
4244
bool isRegexValid = RegexValidator.IsRegexValid(textBox.Text, out string errorMessage);
4345
textBox.ToolTip = isRegexValid ? null : errorMessage;
44-
textBox.Parent.Parent.BackgroundColor = isRegexValid ? Colors.White : Colors.LightSalmon;
46+
textBox.Parent.Parent.BackgroundColor = isRegexValid ? _defaultPanelBackgroundColor : Colors.LightSalmon;
4547
return isRegexValid;
4648
}
4749
}

0 commit comments

Comments
 (0)