From dea6afad848f2ecc637f5b79740ea5dd816c1a1c Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 5 Nov 2019 22:54:16 +0200 Subject: [PATCH] Added indicator (*) in main window title while text is modified --- Crypto Notepad/MainForm.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index da6f83f..1bb899f 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -603,6 +603,16 @@ public void ToolbarIcons(bool oldIcons) #region Event Handlers + private void RichTextBox_ModifiedChanged(object sender, EventArgs e) + { + if (richTextBox.Modified == false) + { + if (Text.Contains("*")) + { + Text = Text.Substring(0, Text.Length - 1); + } + } + } private void StatusPanel_VisibleChanged(object sender, EventArgs e) { if (statusPanel.Visible) @@ -854,6 +864,29 @@ private void RichTextBox_DragDrop(object sender, DragEventArgs e) private void RichTextBox_TextChanged(object sender, EventArgs e) { statusPanelTimer.Start(); + + if (richTextBox.Modified) + { + if (!Text.Contains("*")) + { + Text += "*"; + } + + } + else + { + if (Text.Contains("*")) + { + Text = Text.Substring(0, Text.Length - 1); + } + } + if (richTextBox.TextLength == 0) + { + if (Text.Contains("*")) + { + Text = Text.Substring(0, Text.Length - 1); + } + } } private void StatusPanelLabel_TextChanged(object sender, EventArgs e)