From c397b4fd022fbbd06c05c6f82e167a046f51685b Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 27 Aug 2019 10:04:44 +0300 Subject: [PATCH] Disabled zooming in the editor --- Crypto Notepad/AboutFrom.Designer.cs | 4 +- Crypto Notepad/Crypto Notepad.csproj | 3 + Crypto Notepad/ExRichTextBox.cs | 30 +++++ Crypto Notepad/MainForm.Designer.cs | 195 +++++++++++++++------------ Crypto Notepad/MainForm.cs | 22 +-- 5 files changed, 158 insertions(+), 96 deletions(-) create mode 100644 Crypto Notepad/ExRichTextBox.cs diff --git a/Crypto Notepad/AboutFrom.Designer.cs b/Crypto Notepad/AboutFrom.Designer.cs index a6b20b8..e334952 100644 --- a/Crypto Notepad/AboutFrom.Designer.cs +++ b/Crypto Notepad/AboutFrom.Designer.cs @@ -36,8 +36,8 @@ private void InitializeComponent() this.LicenseLinkLabel = new System.Windows.Forms.LinkLabel(); this.GithubLinkLabel = new System.Windows.Forms.LinkLabel(); this.ContributorsLabel = new System.Windows.Forms.Label(); - this.TPDRichTextBox = new System.Windows.Forms.RichTextBox(); - this.ContributorsRichTextBox = new System.Windows.Forms.RichTextBox(); + this.TPDRichTextBox = new Crypto_Notepad.ExRichTextBox(); + this.ContributorsRichTextBox = new Crypto_Notepad.ExRichTextBox(); ((System.ComponentModel.ISupportInitialize)(this.AppLogoPictureBox)).BeginInit(); this.SuspendLayout(); // diff --git a/Crypto Notepad/Crypto Notepad.csproj b/Crypto Notepad/Crypto Notepad.csproj index d823f6b..4f97611 100644 --- a/Crypto Notepad/Crypto Notepad.csproj +++ b/Crypto Notepad/Crypto Notepad.csproj @@ -120,6 +120,9 @@ EnterKeyForm.cs + + Component + diff --git a/Crypto Notepad/ExRichTextBox.cs b/Crypto Notepad/ExRichTextBox.cs new file mode 100644 index 0000000..de6d4c6 --- /dev/null +++ b/Crypto Notepad/ExRichTextBox.cs @@ -0,0 +1,30 @@ +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace Crypto_Notepad +{ + public class ExRichTextBox : RichTextBox + { + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] + static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + const int WM_MOUSEWHEEL = 0x020A; + const int WM_VSCROLL = 0x115; + protected override void WndProc(ref Message m) + { + if (m.Msg == WM_MOUSEWHEEL) + { + int scrollLines = SystemInformation.MouseWheelScrollLines; + for (int i = 0; i < scrollLines; i++) + { + if ((long)m.WParam <= 2147483647) + SendMessage(Handle, WM_VSCROLL, (IntPtr)0, IntPtr.Zero); + else + SendMessage(Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero); + } + return; + } + base.WndProc(ref m); + } + } +} diff --git a/Crypto Notepad/MainForm.Designer.cs b/Crypto Notepad/MainForm.Designer.cs index 6dfc3e2..7a5fcba 100644 --- a/Crypto Notepad/MainForm.Designer.cs +++ b/Crypto Notepad/MainForm.Designer.cs @@ -86,10 +86,8 @@ public void InitializeComponent() this.SearchTextBox = new System.Windows.Forms.TextBox(); this.MatchCaseCheckBox = new System.Windows.Forms.CheckBox(); this.WholeWordCheckBox = new System.Windows.Forms.CheckBox(); - this.SearchPanel = new System.Windows.Forms.Panel(); this.FindNextButton = new System.Windows.Forms.Button(); this.CloseSearchPanel = new System.Windows.Forms.PictureBox(); - this.ToolbarPanel = new System.Windows.Forms.Panel(); this.CloseToolbar = new System.Windows.Forms.PictureBox(); this.LockToolbarButton = new System.Windows.Forms.PictureBox(); this.SettingsToolbarButton = new System.Windows.Forms.PictureBox(); @@ -102,13 +100,13 @@ public void InitializeComponent() this.FileLocationToolbarButton = new System.Windows.Forms.PictureBox(); this.SaveToolBarButton = new System.Windows.Forms.PictureBox(); this.OpenToolbarButton = new System.Windows.Forms.PictureBox(); - this.RichTextBox = new System.Windows.Forms.RichTextBox(); + this.ToolbarPanel = new System.Windows.Forms.TableLayoutPanel(); + this.SearchPanel = new System.Windows.Forms.TableLayoutPanel(); + this.RichTextBox = new Crypto_Notepad.ExRichTextBox(); this.LineNumbers_For_RichTextBox = new LineNumbers.LineNumbers_For_RichTextBox(); this.MainMenu.SuspendLayout(); this.EditorMenuStrip.SuspendLayout(); - this.SearchPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.CloseSearchPanel)).BeginInit(); - this.ToolbarPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.CloseToolbar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.LockToolbarButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SettingsToolbarButton)).BeginInit(); @@ -121,6 +119,8 @@ public void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.FileLocationToolbarButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SaveToolBarButton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.OpenToolbarButton)).BeginInit(); + this.ToolbarPanel.SuspendLayout(); + this.SearchPanel.SuspendLayout(); this.SuspendLayout(); // // MainMenu @@ -577,14 +577,13 @@ public void InitializeComponent() // // SearchTextBox // - this.SearchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.SearchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.SearchTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35))))); this.SearchTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.SearchTextBox.ForeColor = System.Drawing.Color.White; - this.SearchTextBox.Location = new System.Drawing.Point(3, 6); + this.SearchTextBox.Location = new System.Drawing.Point(3, 9); this.SearchTextBox.Name = "SearchTextBox"; - this.SearchTextBox.Size = new System.Drawing.Size(246, 14); + this.SearchTextBox.Size = new System.Drawing.Size(224, 13); this.SearchTextBox.TabIndex = 9; this.SearchTextBox.TabStop = false; this.SearchTextBox.TextChanged += new System.EventHandler(this.SearchTextBox_TextChanged); @@ -593,14 +592,15 @@ public void InitializeComponent() // MatchCaseCheckBox // this.MatchCaseCheckBox.AutoSize = true; - this.MatchCaseCheckBox.Dock = System.Windows.Forms.DockStyle.Right; + this.MatchCaseCheckBox.Dock = System.Windows.Forms.DockStyle.Fill; this.MatchCaseCheckBox.ForeColor = System.Drawing.Color.Gainsboro; this.MatchCaseCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.MatchCaseCheckBox.Location = new System.Drawing.Point(255, 0); + this.MatchCaseCheckBox.Location = new System.Drawing.Point(233, 3); this.MatchCaseCheckBox.Name = "MatchCaseCheckBox"; - this.MatchCaseCheckBox.Size = new System.Drawing.Size(95, 25); + this.MatchCaseCheckBox.Size = new System.Drawing.Size(96, 25); this.MatchCaseCheckBox.TabIndex = 11; this.MatchCaseCheckBox.Text = "Case sensitive"; + this.MatchCaseCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.MatchCaseCheckBox.UseVisualStyleBackColor = false; this.MatchCaseCheckBox.CheckedChanged += new System.EventHandler(this.MatchCaseCheckBox_CheckedChanged); // @@ -608,49 +608,34 @@ public void InitializeComponent() // this.WholeWordCheckBox.AutoSize = true; this.WholeWordCheckBox.BackColor = System.Drawing.Color.Transparent; - this.WholeWordCheckBox.Dock = System.Windows.Forms.DockStyle.Right; + this.WholeWordCheckBox.Dock = System.Windows.Forms.DockStyle.Fill; this.WholeWordCheckBox.ForeColor = System.Drawing.Color.Gainsboro; this.WholeWordCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.WholeWordCheckBox.Location = new System.Drawing.Point(350, 0); + this.WholeWordCheckBox.Location = new System.Drawing.Point(335, 3); this.WholeWordCheckBox.Name = "WholeWordCheckBox"; - this.WholeWordCheckBox.Size = new System.Drawing.Size(83, 25); + this.WholeWordCheckBox.Size = new System.Drawing.Size(84, 25); this.WholeWordCheckBox.TabIndex = 12; this.WholeWordCheckBox.Text = "Whole word"; + this.WholeWordCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.WholeWordCheckBox.UseVisualStyleBackColor = false; this.WholeWordCheckBox.CheckedChanged += new System.EventHandler(this.WholeWordCheckBox_CheckedChanged); // - // SearchPanel - // - this.SearchPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35))))); - this.SearchPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.SearchPanel.Controls.Add(this.MatchCaseCheckBox); - this.SearchPanel.Controls.Add(this.SearchTextBox); - this.SearchPanel.Controls.Add(this.WholeWordCheckBox); - this.SearchPanel.Controls.Add(this.FindNextButton); - this.SearchPanel.Controls.Add(this.CloseSearchPanel); - this.SearchPanel.Dock = System.Windows.Forms.DockStyle.Bottom; - this.SearchPanel.Font = new System.Drawing.Font("Tahoma", 8.25F); - this.SearchPanel.Location = new System.Drawing.Point(0, 291); - this.SearchPanel.Name = "SearchPanel"; - this.SearchPanel.Size = new System.Drawing.Size(513, 27); - this.SearchPanel.TabIndex = 13; - this.SearchPanel.Visible = false; - // // FindNextButton // this.FindNextButton.Cursor = System.Windows.Forms.Cursors.Hand; - this.FindNextButton.Dock = System.Windows.Forms.DockStyle.Right; + this.FindNextButton.Dock = System.Windows.Forms.DockStyle.Fill; this.FindNextButton.FlatAppearance.BorderColor = System.Drawing.Color.DimGray; this.FindNextButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DimGray; this.FindNextButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.DimGray; this.FindNextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.FindNextButton.ForeColor = System.Drawing.SystemColors.AppWorkspace; - this.FindNextButton.Location = new System.Drawing.Point(433, 0); + this.FindNextButton.Location = new System.Drawing.Point(425, 3); this.FindNextButton.Name = "FindNextButton"; - this.FindNextButton.Size = new System.Drawing.Size(64, 25); + this.FindNextButton.Size = new System.Drawing.Size(66, 25); this.FindNextButton.TabIndex = 15; this.FindNextButton.TabStop = false; this.FindNextButton.Text = "Find Next"; + this.FindNextButton.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.FindNextButton.UseMnemonic = false; this.FindNextButton.UseVisualStyleBackColor = true; this.FindNextButton.Click += new System.EventHandler(this.FindNextButton_Click); @@ -658,12 +643,11 @@ public void InitializeComponent() // CloseSearchPanel // this.CloseSearchPanel.BackColor = System.Drawing.Color.Transparent; - this.CloseSearchPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.CloseSearchPanel.Cursor = System.Windows.Forms.Cursors.Hand; - this.CloseSearchPanel.Dock = System.Windows.Forms.DockStyle.Right; this.CloseSearchPanel.Image = ((System.Drawing.Image)(resources.GetObject("CloseSearchPanel.Image"))); this.CloseSearchPanel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.CloseSearchPanel.Location = new System.Drawing.Point(497, 0); + this.CloseSearchPanel.Location = new System.Drawing.Point(497, 3); + this.CloseSearchPanel.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.CloseSearchPanel.Name = "CloseSearchPanel"; this.CloseSearchPanel.Size = new System.Drawing.Size(14, 25); this.CloseSearchPanel.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -673,36 +657,15 @@ public void InitializeComponent() this.CloseSearchPanel.MouseLeave += new System.EventHandler(this.CloseSearchPanel_MouseLeave); this.CloseSearchPanel.MouseHover += new System.EventHandler(this.CloseSearchPanel_MouseHover); // - // ToolbarPanel - // - this.ToolbarPanel.BackColor = System.Drawing.SystemColors.ButtonFace; - this.ToolbarPanel.Controls.Add(this.CloseToolbar); - this.ToolbarPanel.Controls.Add(this.LockToolbarButton); - this.ToolbarPanel.Controls.Add(this.SettingsToolbarButton); - this.ToolbarPanel.Controls.Add(this.NewToolbarButton); - this.ToolbarPanel.Controls.Add(this.ChangeKeyToolbarButton); - this.ToolbarPanel.Controls.Add(this.PasteToolbarButton); - this.ToolbarPanel.Controls.Add(this.CopyToolbarButton); - this.ToolbarPanel.Controls.Add(this.CutToolbarButton); - this.ToolbarPanel.Controls.Add(this.DeleteFileToolbarButton); - this.ToolbarPanel.Controls.Add(this.FileLocationToolbarButton); - this.ToolbarPanel.Controls.Add(this.SaveToolBarButton); - this.ToolbarPanel.Controls.Add(this.OpenToolbarButton); - this.ToolbarPanel.Dock = System.Windows.Forms.DockStyle.Top; - this.ToolbarPanel.Location = new System.Drawing.Point(0, 24); - this.ToolbarPanel.Name = "ToolbarPanel"; - this.ToolbarPanel.Size = new System.Drawing.Size(513, 23); - this.ToolbarPanel.TabIndex = 14; - // // CloseToolbar // this.CloseToolbar.Cursor = System.Windows.Forms.Cursors.Hand; - this.CloseToolbar.Dock = System.Windows.Forms.DockStyle.Right; this.CloseToolbar.Image = global::Crypto_Notepad.Properties.Resources.close_g; this.CloseToolbar.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.CloseToolbar.Location = new System.Drawing.Point(499, 0); + this.CloseToolbar.Location = new System.Drawing.Point(496, 3); + this.CloseToolbar.Margin = new System.Windows.Forms.Padding(3, 3, 2, 3); this.CloseToolbar.Name = "CloseToolbar"; - this.CloseToolbar.Size = new System.Drawing.Size(14, 23); + this.CloseToolbar.Size = new System.Drawing.Size(14, 17); this.CloseToolbar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.CloseToolbar.TabIndex = 14; this.CloseToolbar.TabStop = false; @@ -715,7 +678,7 @@ public void InitializeComponent() this.LockToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.LockToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("LockToolbarButton.Image"))); this.LockToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.LockToolbarButton.Location = new System.Drawing.Point(235, 3); + this.LockToolbarButton.Location = new System.Drawing.Point(219, 3); this.LockToolbarButton.Name = "LockToolbarButton"; this.LockToolbarButton.Size = new System.Drawing.Size(16, 16); this.LockToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -728,7 +691,7 @@ public void InitializeComponent() this.SettingsToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.SettingsToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("SettingsToolbarButton.Image"))); this.SettingsToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.SettingsToolbarButton.Location = new System.Drawing.Point(260, 3); + this.SettingsToolbarButton.Location = new System.Drawing.Point(243, 3); this.SettingsToolbarButton.Name = "SettingsToolbarButton"; this.SettingsToolbarButton.Size = new System.Drawing.Size(16, 16); this.SettingsToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -741,7 +704,7 @@ public void InitializeComponent() this.NewToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.NewToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("NewToolbarButton.Image"))); this.NewToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.NewToolbarButton.Location = new System.Drawing.Point(10, 3); + this.NewToolbarButton.Location = new System.Drawing.Point(3, 3); this.NewToolbarButton.Name = "NewToolbarButton"; this.NewToolbarButton.Size = new System.Drawing.Size(16, 16); this.NewToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -754,7 +717,7 @@ public void InitializeComponent() this.ChangeKeyToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.ChangeKeyToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("ChangeKeyToolbarButton.Image"))); this.ChangeKeyToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.ChangeKeyToolbarButton.Location = new System.Drawing.Point(210, 3); + this.ChangeKeyToolbarButton.Location = new System.Drawing.Point(195, 3); this.ChangeKeyToolbarButton.Name = "ChangeKeyToolbarButton"; this.ChangeKeyToolbarButton.Size = new System.Drawing.Size(16, 16); this.ChangeKeyToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -767,7 +730,7 @@ public void InitializeComponent() this.PasteToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.PasteToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("PasteToolbarButton.Image"))); this.PasteToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.PasteToolbarButton.Location = new System.Drawing.Point(185, 3); + this.PasteToolbarButton.Location = new System.Drawing.Point(171, 3); this.PasteToolbarButton.Name = "PasteToolbarButton"; this.PasteToolbarButton.Size = new System.Drawing.Size(16, 16); this.PasteToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -780,7 +743,7 @@ public void InitializeComponent() this.CopyToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.CopyToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("CopyToolbarButton.Image"))); this.CopyToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.CopyToolbarButton.Location = new System.Drawing.Point(160, 3); + this.CopyToolbarButton.Location = new System.Drawing.Point(147, 3); this.CopyToolbarButton.Name = "CopyToolbarButton"; this.CopyToolbarButton.Size = new System.Drawing.Size(16, 16); this.CopyToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -793,7 +756,7 @@ public void InitializeComponent() this.CutToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.CutToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("CutToolbarButton.Image"))); this.CutToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.CutToolbarButton.Location = new System.Drawing.Point(135, 3); + this.CutToolbarButton.Location = new System.Drawing.Point(123, 3); this.CutToolbarButton.Name = "CutToolbarButton"; this.CutToolbarButton.Size = new System.Drawing.Size(16, 16); this.CutToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -806,7 +769,7 @@ public void InitializeComponent() this.DeleteFileToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.DeleteFileToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("DeleteFileToolbarButton.Image"))); this.DeleteFileToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.DeleteFileToolbarButton.Location = new System.Drawing.Point(110, 3); + this.DeleteFileToolbarButton.Location = new System.Drawing.Point(99, 3); this.DeleteFileToolbarButton.Name = "DeleteFileToolbarButton"; this.DeleteFileToolbarButton.Size = new System.Drawing.Size(16, 16); this.DeleteFileToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -819,7 +782,7 @@ public void InitializeComponent() this.FileLocationToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.FileLocationToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("FileLocationToolbarButton.Image"))); this.FileLocationToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.FileLocationToolbarButton.Location = new System.Drawing.Point(85, 3); + this.FileLocationToolbarButton.Location = new System.Drawing.Point(75, 3); this.FileLocationToolbarButton.Name = "FileLocationToolbarButton"; this.FileLocationToolbarButton.Size = new System.Drawing.Size(16, 16); this.FileLocationToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -832,7 +795,7 @@ public void InitializeComponent() this.SaveToolBarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.SaveToolBarButton.Image = ((System.Drawing.Image)(resources.GetObject("SaveToolBarButton.Image"))); this.SaveToolBarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.SaveToolBarButton.Location = new System.Drawing.Point(60, 3); + this.SaveToolBarButton.Location = new System.Drawing.Point(51, 3); this.SaveToolBarButton.Name = "SaveToolBarButton"; this.SaveToolBarButton.Size = new System.Drawing.Size(16, 16); this.SaveToolBarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -845,7 +808,7 @@ public void InitializeComponent() this.OpenToolbarButton.Cursor = System.Windows.Forms.Cursors.Hand; this.OpenToolbarButton.Image = ((System.Drawing.Image)(resources.GetObject("OpenToolbarButton.Image"))); this.OpenToolbarButton.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.OpenToolbarButton.Location = new System.Drawing.Point(35, 3); + this.OpenToolbarButton.Location = new System.Drawing.Point(27, 3); this.OpenToolbarButton.Name = "OpenToolbarButton"; this.OpenToolbarButton.Size = new System.Drawing.Size(16, 16); this.OpenToolbarButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -853,17 +816,79 @@ public void InitializeComponent() this.OpenToolbarButton.TabStop = false; this.OpenToolbarButton.Click += new System.EventHandler(this.OpenToolbarButton_Click); // + // ToolbarPanel + // + this.ToolbarPanel.BackColor = System.Drawing.SystemColors.ButtonFace; + this.ToolbarPanel.ColumnCount = 13; + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 24F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.ToolbarPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.ToolbarPanel.Controls.Add(this.LockToolbarButton, 9, 0); + this.ToolbarPanel.Controls.Add(this.NewToolbarButton, 0, 0); + this.ToolbarPanel.Controls.Add(this.ChangeKeyToolbarButton, 8, 0); + this.ToolbarPanel.Controls.Add(this.OpenToolbarButton, 1, 0); + this.ToolbarPanel.Controls.Add(this.PasteToolbarButton, 7, 0); + this.ToolbarPanel.Controls.Add(this.SaveToolBarButton, 2, 0); + this.ToolbarPanel.Controls.Add(this.CopyToolbarButton, 6, 0); + this.ToolbarPanel.Controls.Add(this.FileLocationToolbarButton, 3, 0); + this.ToolbarPanel.Controls.Add(this.CutToolbarButton, 5, 0); + this.ToolbarPanel.Controls.Add(this.DeleteFileToolbarButton, 4, 0); + this.ToolbarPanel.Controls.Add(this.CloseToolbar, 12, 0); + this.ToolbarPanel.Controls.Add(this.SettingsToolbarButton, 10, 0); + this.ToolbarPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.ToolbarPanel.ForeColor = System.Drawing.SystemColors.Control; + this.ToolbarPanel.Location = new System.Drawing.Point(0, 24); + this.ToolbarPanel.Name = "ToolbarPanel"; + this.ToolbarPanel.RowCount = 1; + this.ToolbarPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.ToolbarPanel.Size = new System.Drawing.Size(513, 23); + this.ToolbarPanel.TabIndex = 17; + // + // SearchPanel + // + this.SearchPanel.AutoSize = true; + this.SearchPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(35))))); + this.SearchPanel.ColumnCount = 5; + this.SearchPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.SearchPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 102F)); + this.SearchPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.SearchPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 72F)); + this.SearchPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 19F)); + this.SearchPanel.Controls.Add(this.FindNextButton, 3, 0); + this.SearchPanel.Controls.Add(this.CloseSearchPanel, 4, 0); + this.SearchPanel.Controls.Add(this.SearchTextBox, 0, 0); + this.SearchPanel.Controls.Add(this.WholeWordCheckBox, 2, 0); + this.SearchPanel.Controls.Add(this.MatchCaseCheckBox, 1, 0); + this.SearchPanel.Dock = System.Windows.Forms.DockStyle.Bottom; + this.SearchPanel.Location = new System.Drawing.Point(0, 287); + this.SearchPanel.Name = "SearchPanel"; + this.SearchPanel.RowCount = 1; + this.SearchPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.SearchPanel.Size = new System.Drawing.Size(513, 31); + this.SearchPanel.TabIndex = 17; + this.SearchPanel.Visible = false; + // // RichTextBox // this.RichTextBox.AcceptsTab = true; this.RichTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.RichTextBox.ContextMenuStrip = this.EditorMenuStrip; this.RichTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.RichTextBox.Location = new System.Drawing.Point(18, 47); + this.RichTextBox.Location = new System.Drawing.Point(27, 47); this.RichTextBox.Name = "RichTextBox"; - this.RichTextBox.Size = new System.Drawing.Size(495, 244); + this.RichTextBox.Size = new System.Drawing.Size(486, 240); this.RichTextBox.TabIndex = 16; - this.RichTextBox.Text = ""; + this.RichTextBox.Text = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; this.RichTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RichTextBox_LinkClicked); this.RichTextBox.SelectionChanged += new System.EventHandler(this.RichTextBox_SelectionChanged); this.RichTextBox.Click += new System.EventHandler(this.RichTextBox_Click); @@ -909,7 +934,7 @@ public void InitializeComponent() this.LineNumbers_For_RichTextBox.Show_GridLines = true; this.LineNumbers_For_RichTextBox.Show_LineNrs = true; this.LineNumbers_For_RichTextBox.Show_MarginLines = false; - this.LineNumbers_For_RichTextBox.Size = new System.Drawing.Size(18, 244); + this.LineNumbers_For_RichTextBox.Size = new System.Drawing.Size(27, 240); this.LineNumbers_For_RichTextBox.TabIndex = 15; // // MainForm @@ -920,8 +945,8 @@ public void InitializeComponent() this.Controls.Add(this.RichTextBox); this.Controls.Add(this.LineNumbers_For_RichTextBox); this.Controls.Add(this.ToolbarPanel); - this.Controls.Add(this.SearchPanel); this.Controls.Add(this.MainMenu); + this.Controls.Add(this.SearchPanel); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.MainMenu; @@ -935,11 +960,7 @@ public void InitializeComponent() this.MainMenu.ResumeLayout(false); this.MainMenu.PerformLayout(); this.EditorMenuStrip.ResumeLayout(false); - this.SearchPanel.ResumeLayout(false); - this.SearchPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.CloseSearchPanel)).EndInit(); - this.ToolbarPanel.ResumeLayout(false); - this.ToolbarPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.CloseToolbar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.LockToolbarButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.SettingsToolbarButton)).EndInit(); @@ -952,6 +973,10 @@ public void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.FileLocationToolbarButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.SaveToolBarButton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.OpenToolbarButton)).EndInit(); + this.ToolbarPanel.ResumeLayout(false); + this.ToolbarPanel.PerformLayout(); + this.SearchPanel.ResumeLayout(false); + this.SearchPanel.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -1005,12 +1030,10 @@ public void InitializeComponent() private System.Windows.Forms.TextBox SearchTextBox; private System.Windows.Forms.CheckBox MatchCaseCheckBox; private System.Windows.Forms.CheckBox WholeWordCheckBox; - private System.Windows.Forms.Panel SearchPanel; private System.Windows.Forms.ToolStripMenuItem SettingsToolStripMenuItem; private System.Windows.Forms.PictureBox CloseSearchPanel; private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripMenuItem FindToolStripMenuItem; - private System.Windows.Forms.Panel ToolbarPanel; private System.Windows.Forms.PictureBox NewToolbarButton; private System.Windows.Forms.PictureBox OpenToolbarButton; private System.Windows.Forms.PictureBox SaveToolBarButton; @@ -1032,6 +1055,8 @@ public void InitializeComponent() private LineNumbers.LineNumbers_For_RichTextBox LineNumbers_For_RichTextBox; private System.Windows.Forms.ToolStripMenuItem insertToolStripMenuItem; private System.Windows.Forms.Button FindNextButton; - private System.Windows.Forms.RichTextBox RichTextBox; + private System.Windows.Forms.TableLayoutPanel ToolbarPanel; + private System.Windows.Forms.TableLayoutPanel SearchPanel; + private ExRichTextBox RichTextBox; } } diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index 34cb00e..968b65b 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -512,8 +512,7 @@ private void AutoLock(bool minimize) protected override void WndProc(ref Message m) { const int WM_SYSCOMMAND = 0x112; - const int SC_MINIMIZE = 0xF020; - + const int SC_MINIMIZE = 0xF020; if (m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_MINIMIZE && ps.AutoLock && PublicVar.encryptionKey.Get() != null) { if (ps.AutoSave) @@ -530,6 +529,7 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } + private void MenuIcons() { if (ps.MenuIcons) @@ -570,6 +570,7 @@ private void MenuIcons() } } } + /*Functions*/ @@ -897,6 +898,7 @@ private void RichTextBox_KeyUp(object sender, KeyEventArgs e) shiftPresed = false; } } + private void RichTextBox_TextChanged(object sender, EventArgs e) { LineNumbers_For_RichTextBox.Refresh(); @@ -1184,11 +1186,13 @@ private void FindToolStripMenuItem_Click(object sender, EventArgs e) SearchPanel.Visible = false; RichTextBox.Focus(); RichTextBox.DeselectAll(); + LineNumbers_For_RichTextBox.Height = 1; } else { SearchPanel.Visible = true; SearchTextBox.Focus(); + LineNumbers_For_RichTextBox.Width = 1; } } @@ -1487,12 +1491,12 @@ private void CloseSearchPanel_Click(object sender, EventArgs e) private void CloseSearchPanel_MouseHover(object sender, EventArgs e) { - CloseSearchPanel.BackColor = Color.DimGray; + CloseSearchPanel.Image = Properties.Resources.close_b; } private void CloseSearchPanel_MouseLeave(object sender, EventArgs e) { - CloseSearchPanel.BackColor = Color.Transparent; + CloseSearchPanel.Image = Properties.Resources.close_g; } private void MatchCaseCheckBox_CheckedChanged(object sender, EventArgs e) @@ -1507,7 +1511,7 @@ private void WholeWordCheckBox_CheckedChanged(object sender, EventArgs e) RichTextBox.DeselectAll(); } - private void FindMyText(string text, RichTextBoxFinds findOptions) + private void FindText(string text, RichTextBoxFinds findOptions) { if (text.Length > 0) { @@ -1533,25 +1537,25 @@ private void FindNextButton_Click(object sender, EventArgs e) { if ((!WholeWordCheckBox.Checked) & (!MatchCaseCheckBox.Checked)) { - FindMyText(SearchTextBox.Text, RichTextBoxFinds.None); + FindText(SearchTextBox.Text, RichTextBoxFinds.None); return; } if (WholeWordCheckBox.Checked & MatchCaseCheckBox.Checked) { - FindMyText(SearchTextBox.Text, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord); + FindText(SearchTextBox.Text, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord); return; } if (MatchCaseCheckBox.Checked) { - FindMyText(SearchTextBox.Text, RichTextBoxFinds.MatchCase); + FindText(SearchTextBox.Text, RichTextBoxFinds.MatchCase); return; } if (WholeWordCheckBox.Checked) { - FindMyText(SearchTextBox.Text, RichTextBoxFinds.WholeWord); + FindText(SearchTextBox.Text, RichTextBoxFinds.WholeWord); return; } }