From 99f4c6e46c23211967b59e9ee23dc2372b101920 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Fri, 18 Jun 2021 19:31:30 +0200 Subject: [PATCH] [Feature] CodeBuity&Refactor (#49) --- Business/KeyboardInput.cs | 2 +- Business/Menus.cs | 2 +- DataClasses/RowData.cs | 2 +- Properties/CustomSettingsProvider.cs | 6 +- UserInterface/AppNotifyIcon.cs | 2 +- .../CustomScrollbar/CustomScrollbar.cs | 2 +- .../Menu.ControlsTheDesignerRemoves.cs | 112 +++++++++++ UserInterface/Menu.Designer.cs | 174 ++++++++---------- UserInterface/SettingsForm.Designer.cs | 22 +-- UserInterface/SettingsForm.cs | 6 +- .../ShellContextMenu/ShellContextMenu.cs | 2 +- 11 files changed, 213 insertions(+), 119 deletions(-) create mode 100644 UserInterface/Menu.ControlsTheDesignerRemoves.cs diff --git a/Business/KeyboardInput.cs b/Business/KeyboardInput.cs index 462777e..d18c0a6 100644 --- a/Business/KeyboardInput.cs +++ b/Business/KeyboardInput.cs @@ -12,7 +12,7 @@ namespace SystemTrayMenu.Handler using SystemTrayMenu.DataClasses; using SystemTrayMenu.Helper; using SystemTrayMenu.Utilities; - using Menu = SystemTrayMenu.UserInterface.Menu; + using Menu = UserInterface.Menu; internal class KeyboardInput : IDisposable { diff --git a/Business/Menus.cs b/Business/Menus.cs index 8e224e5..d834285 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.Business using SystemTrayMenu.Handler; using SystemTrayMenu.Helper; using SystemTrayMenu.Utilities; - using Menu = SystemTrayMenu.UserInterface.Menu; + using Menu = UserInterface.Menu; using Timer = System.Windows.Forms.Timer; internal class Menus : IDisposable diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index e7271c1..f2c77a4 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.DataClasses using IWshRuntimeLibrary; using SystemTrayMenu.Utilities; using TAFactory.IconPack; - using Menu = SystemTrayMenu.UserInterface.Menu; + using Menu = UserInterface.Menu; internal class RowData : IDisposable { diff --git a/Properties/CustomSettingsProvider.cs b/Properties/CustomSettingsProvider.cs index c1fa28d..daf666b 100644 --- a/Properties/CustomSettingsProvider.cs +++ b/Properties/CustomSettingsProvider.cs @@ -191,7 +191,7 @@ namespace SystemTrayMenu.Properties XDeclaration declaration = new XDeclaration("1.0", "utf-8", "true"); XElement config = new XElement(Config); XElement userSettings = new XElement(UserSettings); - XElement group = new XElement(typeof(Properties.Settings).FullName); + XElement group = new XElement(typeof(Settings).FullName); userSettings.Add(group); config.Add(userSettings); doc.Add(config); @@ -241,7 +241,7 @@ namespace SystemTrayMenu.Properties } // get all of the elements. - IEnumerable settingElements = configXml.Element(Config).Element(UserSettings).Element(typeof(Properties.Settings).FullName).Elements(Setting); + IEnumerable settingElements = configXml.Element(Config).Element(UserSettings).Element(typeof(Settings).FullName).Elements(Setting); // iterate through, adding them to the dictionary, (checking for nulls, xml no likey nulls) // using "String" as default serializeAs...just in case, no real good reason. @@ -274,7 +274,7 @@ namespace SystemTrayMenu.Properties } // get the settings group (e.g. ) - XElement settingsSection = import.Element(Config).Element(UserSettings).Element(typeof(Properties.Settings).FullName); + XElement settingsSection = import.Element(Config).Element(UserSettings).Element(typeof(Settings).FullName); // iterate though the dictionary, either updating the value or adding the new setting. foreach (KeyValuePair entry in SettingsDictionary) diff --git a/UserInterface/AppNotifyIcon.cs b/UserInterface/AppNotifyIcon.cs index 9c3aaa6..489f222 100644 --- a/UserInterface/AppNotifyIcon.cs +++ b/UserInterface/AppNotifyIcon.cs @@ -11,7 +11,7 @@ namespace SystemTrayMenu.UserInterface using System.Windows.Forms; using SystemTrayMenu.Helper; using SystemTrayMenu.Utilities; - using R = SystemTrayMenu.Properties.Resources; + using R = Properties.Resources; using Timer = System.Windows.Forms.Timer; internal class AppNotifyIcon : IDisposable diff --git a/UserInterface/CustomScrollbar/CustomScrollbar.cs b/UserInterface/CustomScrollbar/CustomScrollbar.cs index 167b3ec..b178db8 100644 --- a/UserInterface/CustomScrollbar/CustomScrollbar.cs +++ b/UserInterface/CustomScrollbar/CustomScrollbar.cs @@ -746,7 +746,7 @@ namespace SystemTrayMenu.UserInterface private float GetChangeForOneItem(float change, int pixelRange) { - return (change * pixelRange) / (Maximum - LargeChange); + return change * pixelRange / (Maximum - LargeChange); } private int GetTrackHeight() diff --git a/UserInterface/Menu.ControlsTheDesignerRemoves.cs b/UserInterface/Menu.ControlsTheDesignerRemoves.cs new file mode 100644 index 0000000..3552b47 --- /dev/null +++ b/UserInterface/Menu.ControlsTheDesignerRemoves.cs @@ -0,0 +1,112 @@ +namespace SystemTrayMenu.UserInterface +{ + using System; + using System.Drawing; + using System.Windows.Forms; + + internal partial class Menu + { + private void InitializeComponentControlsTheDesignerRemoves() + { + DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); + + labelTitle = new LabelNoCopy(); + ColumnText = new DataGridViewTextBoxColumn(); + ColumnIcon = new DataGridViewImageColumn(); + + customScrollbar = new CustomScrollbar(); + + tableLayoutPanelDgvAndScrollbar.Controls.Add(customScrollbar, 1, 0); + + //tableLayoutPanelDgvAndScrollbar.SuspendLayout(); + //((System.ComponentModel.ISupportInitialize)dgv).BeginInit(); + //tableLayoutPanelSearch.SuspendLayout(); + //((System.ComponentModel.ISupportInitialize)pictureBoxSearch).BeginInit(); + //tableLayoutPanelMenu.SuspendLayout(); + //SuspendLayout(); + + // labelTitle + labelTitle.AutoEllipsis = true; + labelTitle.AutoSize = true; + labelTitle.Dock = DockStyle.Fill; + labelTitle.BackColor = Color.Azure; + labelTitle.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold, GraphicsUnit.Point, (byte)0); + labelTitle.ForeColor = Color.Black; + labelTitle.Location = new Point(0, 0); + labelTitle.Margin = new Padding(0); + labelTitle.Name = "labelTitle"; + labelTitle.Padding = new Padding(3, 0, 0, 1); + labelTitle.Size = new Size(70, 14); + labelTitle.Text = "STM"; + labelTitle.TextAlign = ContentAlignment.MiddleCenter; + labelTitle.MouseDoubleClick += new MouseEventHandler(LabelTitle_MouseDoubleClick); + labelTitle.MouseEnter += new EventHandler(LabelTitle_MouseEnter); + labelTitle.MouseLeave += new EventHandler(LabelTitle_MouseLeave); + labelTitle.MouseWheel += new MouseEventHandler(DgvMouseWheel); + + // ColumnIcon + ColumnIcon.DataPropertyName = "ColumnIcon"; + dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle1.NullValue = "System.Drawing.Icon"; + dataGridViewCellStyle1.Padding = new Padding(3, 2, 6, 2); + ColumnIcon.DefaultCellStyle = dataGridViewCellStyle1; + ColumnIcon.Frozen = true; + ColumnIcon.HeaderText = "ColumnIcon"; + ColumnIcon.ImageLayout = DataGridViewImageCellLayout.Zoom; + ColumnIcon.Name = "ColumnIcon"; + ColumnIcon.ReadOnly = true; + ColumnIcon.Resizable = DataGridViewTriState.False; + ColumnIcon.Width = 25; + + // ColumnText + ColumnText.DataPropertyName = "ColumnText"; + dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.Padding = new Padding(0, 0, 3, 0); + ColumnText.DefaultCellStyle = dataGridViewCellStyle2; + ColumnText.Frozen = true; + ColumnText.HeaderText = "ColumnText"; + ColumnText.MaxInputLength = 40; + ColumnText.Name = "ColumnText"; + ColumnText.ReadOnly = true; + ColumnText.Resizable = DataGridViewTriState.False; + ColumnText.SortMode = DataGridViewColumnSortMode.Programmatic; + ColumnText.Width = 25; + + dgv.Columns.AddRange(new DataGridViewColumn[] + { + ColumnIcon, + ColumnText, + }); + + dataGridViewCellStyle3.Font = new Font("Segoe UI", 7F, FontStyle.Regular, GraphicsUnit.Pixel, (byte)0); + dgv.RowsDefaultCellStyle = dataGridViewCellStyle3; + + dgv.RowTemplate.DefaultCellStyle.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, (byte)0); + dgv.RowTemplate.Height = 20; + dgv.RowTemplate.ReadOnly = true; + + textBoxSearch.ContextMenuStrip = new ContextMenuStrip(); + + tableLayoutPanelTitle.Controls.Add(labelTitle, 1, 0); + //tableLayoutPanelMenu.Controls.Add(labelTitle, 0, 0); + + // customScrollbar + customScrollbar.Location = new Point(0, 0); + customScrollbar.Name = "customScrollbar"; + customScrollbar.Size = new Size(15, 40); + + //tableLayoutPanelDgvAndScrollbar.ResumeLayout(false); + //((System.ComponentModel.ISupportInitialize)dgv).EndInit(); + //tableLayoutPanelSearch.ResumeLayout(false); + //tableLayoutPanelSearch.PerformLayout(); + //((System.ComponentModel.ISupportInitialize)pictureBoxSearch).EndInit(); + //tableLayoutPanelMenu.ResumeLayout(false); + //tableLayoutPanelMenu.PerformLayout(); + //customScrollbar.PerformLayout(); + //ResumeLayout(false); + //PerformLayout(); + } + } +} \ No newline at end of file diff --git a/UserInterface/Menu.Designer.cs b/UserInterface/Menu.Designer.cs index a9608d6..2f8cbf2 100644 --- a/UserInterface/Menu.Designer.cs +++ b/UserInterface/Menu.Designer.cs @@ -30,27 +30,28 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.tableLayoutPanelDgvAndScrollbar = new System.Windows.Forms.TableLayoutPanel(); - this.labelTitle = new SystemTrayMenu.UserInterface.LabelNoCopy(); - this.ColumnText = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColumnIcon = new System.Windows.Forms.DataGridViewImageColumn(); this.dgv = new System.Windows.Forms.DataGridView(); this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel(); this.textBoxSearch = new System.Windows.Forms.TextBox(); this.pictureBoxSearch = new System.Windows.Forms.PictureBox(); this.tableLayoutPanelMenu = new System.Windows.Forms.TableLayoutPanel(); - this.customScrollbar = new UserInterface.CustomScrollbar(); + this.tableLayoutPanelTitle = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.tableLayoutPanelDgvAndScrollbar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.tableLayoutPanelSearch.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).BeginInit(); this.tableLayoutPanelMenu.SuspendLayout(); + this.tableLayoutPanelTitle.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); + // Controls like the scrollbar are removed when open the designer + // When adding after InitializeComponent(), then e.g. scrollbar on high dpi not more working + InitializeComponentControlsTheDesignerRemoves(); // // tableLayoutPanelDgvAndScrollbar // @@ -60,68 +61,16 @@ this.tableLayoutPanelDgvAndScrollbar.ColumnCount = 2; this.tableLayoutPanelDgvAndScrollbar.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanelDgvAndScrollbar.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanelDgvAndScrollbar.Controls.Add(this.customScrollbar, 1, 0); this.tableLayoutPanelDgvAndScrollbar.Controls.Add(this.dgv, 0, 0); - this.tableLayoutPanelDgvAndScrollbar.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanelDgvAndScrollbar.Location = new System.Drawing.Point(0, 14); this.tableLayoutPanelDgvAndScrollbar.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanelDgvAndScrollbar.Name = "tableLayoutPanelDgvAndScrollbar"; this.tableLayoutPanelDgvAndScrollbar.RowCount = 1; this.tableLayoutPanelDgvAndScrollbar.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelDgvAndScrollbar.Size = new System.Drawing.Size(70, 40); + this.tableLayoutPanelDgvAndScrollbar.Size = new System.Drawing.Size(55, 40); this.tableLayoutPanelDgvAndScrollbar.TabIndex = 3; this.tableLayoutPanelDgvAndScrollbar.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); // - // labelTitle - // - this.labelTitle.AutoEllipsis = true; - this.labelTitle.AutoSize = true; - this.labelTitle.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelTitle.BackColor = System.Drawing.Color.Azure; - this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelTitle.ForeColor = System.Drawing.Color.Black; - this.labelTitle.Location = new System.Drawing.Point(0, 0); - this.labelTitle.Margin = new System.Windows.Forms.Padding(0); - this.labelTitle.Name = "labelTitle"; - this.labelTitle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 1); - this.labelTitle.Size = new System.Drawing.Size(70, 14); - this.labelTitle.TabIndex = 2; - this.labelTitle.Text = "STM"; - this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.labelTitle.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.LabelTitle_MouseDoubleClick); - this.labelTitle.MouseEnter += new System.EventHandler(this.LabelTitle_MouseEnter); - this.labelTitle.MouseLeave += new System.EventHandler(this.LabelTitle_MouseLeave); - this.labelTitle.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); - // - // ColumnText - // - this.ColumnText.DataPropertyName = "ColumnText"; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0); - this.ColumnText.DefaultCellStyle = dataGridViewCellStyle2; - this.ColumnText.Frozen = true; - this.ColumnText.HeaderText = "ColumnText"; - this.ColumnText.MaxInputLength = 40; - this.ColumnText.Name = "ColumnText"; - this.ColumnText.ReadOnly = true; - this.ColumnText.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.ColumnText.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic; - this.ColumnText.Width = 25; - // - // ColumnIcon - // - this.ColumnIcon.DataPropertyName = "ColumnIcon"; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.NullValue = "System.Drawing.Icon"; - dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(3, 2, 6, 2); - this.ColumnIcon.DefaultCellStyle = dataGridViewCellStyle1; - this.ColumnIcon.Frozen = true; - this.ColumnIcon.HeaderText = "ColumnIcon"; - this.ColumnIcon.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.ColumnIcon.Name = "ColumnIcon"; - this.ColumnIcon.ReadOnly = true; - this.ColumnIcon.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.ColumnIcon.Width = 25; - // // dgv // this.dgv.AllowUserToAddRows = false; @@ -136,20 +85,14 @@ this.dgv.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dgv.ColumnHeadersVisible = false; - this.dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.ColumnIcon, - this.ColumnText}); - this.dgv.Location = new System.Drawing.Point(0, 14); + this.dgv.Location = new System.Drawing.Point(0, 0); this.dgv.Margin = new System.Windows.Forms.Padding(0); this.dgv.Name = "dgv"; this.dgv.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.dgv.RowHeadersVisible = false; this.dgv.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); - this.dgv.RowsDefaultCellStyle = dataGridViewCellStyle3; - this.dgv.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dgv.RowTemplate.Height = 20; - this.dgv.RowTemplate.ReadOnly = true; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.dgv.RowsDefaultCellStyle = dataGridViewCellStyle1; this.dgv.ScrollBars = System.Windows.Forms.ScrollBars.None; this.dgv.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgv.ShowCellErrors = false; @@ -171,15 +114,29 @@ this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanelSearch.Controls.Add(this.textBoxSearch, 1, 0); this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxSearch, 0, 0); - this.tableLayoutPanelSearch.Location = new System.Drawing.Point(0, 146); + this.tableLayoutPanelSearch.Location = new System.Drawing.Point(0, 55); this.tableLayoutPanelSearch.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0); this.tableLayoutPanelSearch.Name = "tableLayoutPanelSearch"; this.tableLayoutPanelSearch.RowCount = 1; this.tableLayoutPanelSearch.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelSearch.Size = new System.Drawing.Size(70, 22); + this.tableLayoutPanelSearch.Size = new System.Drawing.Size(83, 22); this.tableLayoutPanelSearch.TabIndex = 5; this.tableLayoutPanelSearch.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); // + // textBoxSearch + // + this.textBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxSearch.BackColor = System.Drawing.Color.White; + this.textBoxSearch.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxSearch.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.textBoxSearch.Location = new System.Drawing.Point(25, 4); + this.textBoxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 2); + this.textBoxSearch.MaxLength = 37; + this.textBoxSearch.Name = "textBoxSearch"; + this.textBoxSearch.Size = new System.Drawing.Size(55, 15); + this.textBoxSearch.TabIndex = 0; + this.textBoxSearch.TextChanged += new System.EventHandler(this.TextBoxSearch_TextChanged); + // // pictureBoxSearch // this.pictureBoxSearch.BackColor = System.Drawing.Color.White; @@ -190,28 +147,13 @@ this.pictureBoxSearch.TabIndex = 1; this.pictureBoxSearch.TabStop = false; // - // textBoxSearch - // - this.textBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxSearch.BackColor = System.Drawing.Color.White; - this.textBoxSearch.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBoxSearch.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold); - this.textBoxSearch.Location = new System.Drawing.Point(25, 4); - this.textBoxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 2); - this.textBoxSearch.MaxLength = 37; - this.textBoxSearch.Name = "textBoxSearch"; - this.textBoxSearch.Size = new System.Drawing.Size(55, 15); - this.textBoxSearch.TabIndex = 0; - this.textBoxSearch.TextChanged += new System.EventHandler(this.TextBoxSearch_TextChanged); - this.textBoxSearch.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); - // // tableLayoutPanelMenu // this.tableLayoutPanelMenu.AutoSize = true; this.tableLayoutPanelMenu.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanelMenu.ColumnCount = 1; this.tableLayoutPanelMenu.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanelMenu.Controls.Add(this.labelTitle, 0, 0); + this.tableLayoutPanelMenu.Controls.Add(this.tableLayoutPanelTitle, 0, 0); this.tableLayoutPanelMenu.Controls.Add(this.tableLayoutPanelSearch, 0, 2); this.tableLayoutPanelMenu.Controls.Add(this.tableLayoutPanelDgvAndScrollbar, 0, 1); this.tableLayoutPanelMenu.Location = new System.Drawing.Point(1, 1); @@ -221,16 +163,50 @@ this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelMenu.Size = new System.Drawing.Size(70, 76); + this.tableLayoutPanelMenu.Size = new System.Drawing.Size(83, 77); this.tableLayoutPanelMenu.TabIndex = 4; this.tableLayoutPanelMenu.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); // - // customScrollbar + // tableLayoutPanelTitle // - this.customScrollbar.Location = new System.Drawing.Point(0, 0); - this.customScrollbar.Name = "customScrollbar"; - this.customScrollbar.Size = new System.Drawing.Size(15, 40); - this.customScrollbar.TabIndex = 5; + this.tableLayoutPanelTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanelTitle.AutoSize = true; + this.tableLayoutPanelTitle.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanelTitle.ColumnCount = 3; + this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelTitle.Controls.Add(this.pictureBox1, 0, 0); + this.tableLayoutPanelTitle.Controls.Add(this.pictureBox2, 2, 0); + this.tableLayoutPanelTitle.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanelTitle.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanelTitle.Name = "tableLayoutPanelTitle"; + this.tableLayoutPanelTitle.RowCount = 1; + this.tableLayoutPanelTitle.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelTitle.Size = new System.Drawing.Size(83, 14); + this.tableLayoutPanelTitle.TabIndex = 5; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pictureBox1.Location = new System.Drawing.Point(0, 0); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(0); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(14, 14); + this.pictureBox1.TabIndex = 1; + this.pictureBox1.TabStop = false; + // + // pictureBox2 + // + this.pictureBox2.BackColor = System.Drawing.Color.White; + this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pictureBox2.Location = new System.Drawing.Point(69, 0); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(0); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(14, 14); + this.pictureBox2.TabIndex = 1; + this.pictureBox2.TabStop = false; // // Menu // @@ -239,7 +215,7 @@ this.AutoSize = true; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(331, 360); + this.ClientSize = new System.Drawing.Size(302, 347); this.Controls.Add(this.tableLayoutPanelMenu); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "Menu"; @@ -256,6 +232,9 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).EndInit(); this.tableLayoutPanelMenu.ResumeLayout(false); this.tableLayoutPanelMenu.PerformLayout(); + this.tableLayoutPanelTitle.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -272,5 +251,8 @@ private System.Windows.Forms.PictureBox pictureBoxSearch; private UserInterface.CustomScrollbar customScrollbar; private System.Windows.Forms.TableLayoutPanel tableLayoutPanelMenu; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelTitle; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox pictureBox2; } } \ No newline at end of file diff --git a/UserInterface/SettingsForm.Designer.cs b/UserInterface/SettingsForm.Designer.cs index b2335e3..03a0fcc 100644 --- a/UserInterface/SettingsForm.Designer.cs +++ b/UserInterface/SettingsForm.Designer.cs @@ -39,6 +39,7 @@ namespace SystemTrayMenu.UserInterface this.textBoxFolder = new System.Windows.Forms.TextBox(); this.tableLayoutPanelChangeFolder = new System.Windows.Forms.TableLayoutPanel(); this.buttonChangeFolder = new System.Windows.Forms.Button(); + this.checkBoxUseIconFromRootFolder = new System.Windows.Forms.CheckBox(); this.groupBoxUSB = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelUSB = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanelRelativeFolderOpenAssembly = new System.Windows.Forms.TableLayoutPanel(); @@ -242,7 +243,6 @@ namespace SystemTrayMenu.UserInterface this.buttonOk = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.colorDialog = new System.Windows.Forms.ColorDialog(); - this.checkBoxUseIconFromRootFolder = new System.Windows.Forms.CheckBox(); this.tableLayoutPanelMain.SuspendLayout(); this.tabControl.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); @@ -498,6 +498,16 @@ namespace SystemTrayMenu.UserInterface this.buttonChangeFolder.UseVisualStyleBackColor = true; this.buttonChangeFolder.Click += new System.EventHandler(this.ButtonChange_Click); // + // checkBoxUseIconFromRootFolder + // + this.checkBoxUseIconFromRootFolder.AutoSize = true; + this.checkBoxUseIconFromRootFolder.Location = new System.Drawing.Point(3, 56); + this.checkBoxUseIconFromRootFolder.Name = "checkBoxUseIconFromRootFolder"; + this.checkBoxUseIconFromRootFolder.Size = new System.Drawing.Size(205, 19); + this.checkBoxUseIconFromRootFolder.TabIndex = 1; + this.checkBoxUseIconFromRootFolder.Text = "checkBoxUseIconFromRootFolder"; + this.checkBoxUseIconFromRootFolder.UseVisualStyleBackColor = true; + // // groupBoxUSB // this.groupBoxUSB.AutoSize = true; @@ -3198,16 +3208,6 @@ namespace SystemTrayMenu.UserInterface this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // - // checkBoxUseIconFromRootFolder - // - this.checkBoxUseIconFromRootFolder.AutoSize = true; - this.checkBoxUseIconFromRootFolder.Location = new System.Drawing.Point(3, 56); - this.checkBoxUseIconFromRootFolder.Name = "checkBoxUseIconFromRootFolder"; - this.checkBoxUseIconFromRootFolder.Size = new System.Drawing.Size(205, 19); - this.checkBoxUseIconFromRootFolder.TabIndex = 1; - this.checkBoxUseIconFromRootFolder.Text = "checkBoxUseIconFromRootFolder"; - this.checkBoxUseIconFromRootFolder.UseVisualStyleBackColor = true; - // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index 3b6c236..eafdb6f 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -40,14 +40,14 @@ namespace SystemTrayMenu.UserInterface Size = new Size(200, 20), Text = "None", }; - textBoxHotkey.Enter += new EventHandler(this.TextBoxHotkeyEnter); - textBoxHotkey.Leave += new EventHandler(this.TextBoxHotkey_Leave); + textBoxHotkey.Enter += new EventHandler(TextBoxHotkeyEnter); + textBoxHotkey.Leave += new EventHandler(TextBoxHotkey_Leave); tableLayoutPanelHotkey.Controls.Remove(textBoxHotkeyPlaceholder); tableLayoutPanelHotkey.Controls.Add(textBoxHotkey, 0, 0); } // designer always resets it to 1 - this.tabControl.SelectedIndex = 0; + tabControl.SelectedIndex = 0; CombineControls(textBoxColorTitle, pictureBoxTitle); CombineControls(textBoxColorBackground, pictureBoxBackground); diff --git a/UserInterface/ShellContextMenu/ShellContextMenu.cs b/UserInterface/ShellContextMenu/ShellContextMenu.cs index 13140da..eada81b 100644 --- a/UserInterface/ShellContextMenu/ShellContextMenu.cs +++ b/UserInterface/ShellContextMenu/ShellContextMenu.cs @@ -584,7 +584,7 @@ namespace SystemTrayMenu.Utilities [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [GuidAttribute("000214e4-0000-0000-c000-000000000046")] + [Guid("000214e4-0000-0000-c000-000000000046")] private interface IContextMenu { // Adds commands to a shortcut menu