From 0a310aadb00026afafffbf3ccc181e731e057ee6 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sun, 27 Jun 2021 14:44:12 +0200 Subject: [PATCH] [Feature] Show how many folders and files a folder contains in searchbar (#189), version 1.0.17.67 --- Business/KeyboardInput.cs | 3 +- Business/Menus.cs | 60 +++++++++----- Config/Config.cs | 4 +- Properties/AssemblyInfo.cs | 4 +- Properties/Resources.Designer.cs | 20 +++++ Properties/Resources.resx | 6 ++ Resources/ic_fluent_document_48_regular.svg | 3 + ...c_fluent_folder_arrow_right_48_regular.svg | 3 + .../Menu.ControlsTheDesignerRemoves.cs | 11 +++ UserInterface/Menu.Designer.cs | 82 +++++++++++++++++-- UserInterface/Menu.cs | 41 +++++++++- 11 files changed, 203 insertions(+), 34 deletions(-) create mode 100644 Resources/ic_fluent_document_48_regular.svg create mode 100644 Resources/ic_fluent_folder_arrow_right_48_regular.svg diff --git a/Business/KeyboardInput.cs b/Business/KeyboardInput.cs index 462777e..2b8dbb8 100644 --- a/Business/KeyboardInput.cs +++ b/Business/KeyboardInput.cs @@ -190,9 +190,8 @@ namespace SystemTrayMenu.Handler ClearIsSelectedByKey(); } - internal void SearchTextChanged(object sender, EventArgs e) + internal void SearchTextChanged(Menu menu) { - Menu menu = (Menu)sender; DataGridView dgv = menu.GetDataGridView(); if (dgv.Rows.Count > 0) { diff --git a/Business/Menus.cs b/Business/Menus.cs index c219b87..72dd676 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -626,28 +626,23 @@ namespace SystemTrayMenu.Business { Menu menu = new Menu(); - if (title != null) + string path = Config.Path; + if (title == null) { - if (string.IsNullOrEmpty(title)) - { - title = Path.GetPathRoot(Config.Path); - } - - menu.SetTitle(title); - menu.UserClickedOpenFolder += OpenMainFolder; - void OpenMainFolder() - { - OpenFolder(); - } + title = Path.GetFileName(menuData.RowDataParent.TargetFilePath); + path = menuData.RowDataParent.TargetFilePath; } - else + + if (string.IsNullOrEmpty(title)) { - menu.SetTitle(Path.GetFileName(menuData.RowDataParent.TargetFilePath)); - menu.UserClickedOpenFolder += OpenSubFolder; - void OpenSubFolder() - { - OpenFolder(menuData.RowDataParent.TargetFilePath); - } + title = Path.GetPathRoot(path); + } + + menu.SetTitle(title); + menu.UserClickedOpenFolder += OpenFolderInExplorer; + void OpenFolderInExplorer() + { + OpenFolder(path); } menu.Level = menuData.Level; @@ -680,9 +675,11 @@ namespace SystemTrayMenu.Business } menu.VisibleChanged += MenuVisibleChanged; - AddItemsToMenu(menuData.RowDatas, menu); - static void AddItemsToMenu(List data, Menu menu) + AddItemsToMenu(menuData.RowDatas, menu, out int foldersCount, out int filesCount); + static void AddItemsToMenu(List data, Menu menu, out int foldersCount, out int filesCount) { + foldersCount = 0; + filesCount = 0; DataGridView dgv = menu.GetDataGridView(); DataTable dataTable = new DataTable(); dataTable.Columns.Add(dgv.Columns[0].Name, typeof(Icon)); @@ -691,6 +688,15 @@ namespace SystemTrayMenu.Business dataTable.Columns.Add("SortIndex"); foreach (RowData rowData in data) { + if (rowData.ContainsMenu) + { + foldersCount++; + } + else + { + filesCount++; + } + rowData.SetData(rowData, dataTable); } @@ -716,6 +722,8 @@ namespace SystemTrayMenu.Business Log.Warn("Dgv_DataError occured", e.Exception); } + menu.SetCounts(foldersCount, filesCount); + return menu; } @@ -1011,9 +1019,17 @@ namespace SystemTrayMenu.Business private void Menu_SearchTextChanged(object sender, EventArgs e) { - keyboardInput.SearchTextChanged(sender, e); + Menu menu = (Menu)sender; + keyboardInput.SearchTextChanged(menu); AdjustMenusSizeAndLocation(); searchTextChanging = false; + + // if any open menu close + Menu menuToClose = menus[menu.Level + 1]; + if (menuToClose != null) + { + HideOldMenu(menuToClose); + } } } } diff --git a/Config/Config.cs b/Config/Config.cs index e1d8f5c..a29d223 100644 --- a/Config/Config.cs +++ b/Config/Config.cs @@ -18,10 +18,12 @@ namespace SystemTrayMenu public static class Config { - internal static readonly Bitmap BitmapOpenFolder = ReadSvg(Properties.Resources.ic_fluent_folder_48_regular); + internal static readonly Bitmap BitmapOpenFolder = ReadSvg(Properties.Resources.ic_fluent_folder_arrow_right_48_regular); internal static readonly Bitmap BitmapPin = ReadSvg(Properties.Resources.ic_fluent_pin_48_regular); internal static readonly Bitmap BitmapPinActive = ReadSvg(Properties.Resources.ic_fluent_pin_48_filled); internal static readonly Bitmap BitmapSearch = ReadSvg(Properties.Resources.ic_fluent_search_48_regular); + internal static readonly Bitmap BitmapFoldersCount = ReadSvg(Properties.Resources.ic_fluent_folder_48_regular); + internal static readonly Bitmap BitmapFilesCount = ReadSvg(Properties.Resources.ic_fluent_document_48_regular); private static bool readDarkModeDone; private static bool isDarkMode; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 0e58c5a..975baea 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.17.66")] -[assembly: AssemblyFileVersion("1.0.17.66")] +[assembly: AssemblyVersion("1.0.17.67")] +[assembly: AssemblyFileVersion("1.0.17.67")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index d2b48d0..ea58bcd 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace SystemTrayMenu.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + public static byte[] ic_fluent_document_48_regular { + get { + object obj = ResourceManager.GetObject("ic_fluent_document_48_regular", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// @@ -70,6 +80,16 @@ namespace SystemTrayMenu.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + public static byte[] ic_fluent_folder_arrow_right_48_regular { + get { + object obj = ResourceManager.GetObject("ic_fluent_folder_arrow_right_48_regular", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 081e7ae..64ecebe 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -193,4 +193,10 @@ ..\Resources\ic_fluent_search_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\ic_fluent_document_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ic_fluent_folder_arrow_right_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/Resources/ic_fluent_document_48_regular.svg b/Resources/ic_fluent_document_48_regular.svg new file mode 100644 index 0000000..0d336c0 --- /dev/null +++ b/Resources/ic_fluent_document_48_regular.svg @@ -0,0 +1,3 @@ + + + diff --git a/Resources/ic_fluent_folder_arrow_right_48_regular.svg b/Resources/ic_fluent_folder_arrow_right_48_regular.svg new file mode 100644 index 0000000..0514e6e --- /dev/null +++ b/Resources/ic_fluent_folder_arrow_right_48_regular.svg @@ -0,0 +1,3 @@ + + + diff --git a/UserInterface/Menu.ControlsTheDesignerRemoves.cs b/UserInterface/Menu.ControlsTheDesignerRemoves.cs index aacfecc..9c3744d 100644 --- a/UserInterface/Menu.ControlsTheDesignerRemoves.cs +++ b/UserInterface/Menu.ControlsTheDesignerRemoves.cs @@ -109,6 +109,17 @@ namespace SystemTrayMenu.UserInterface Scaling.Scale(pictureBoxSearch.Width), Scaling.Scale(pictureBoxSearch.Height)); + pictureBoxFoldersCount.Size = new Size( + Scaling.Scale(pictureBoxFoldersCount.Width), + Scaling.Scale(pictureBoxFoldersCount.Height)); + + pictureBoxFilesCount.Size = new Size( + Scaling.Scale(pictureBoxFilesCount.Width), + Scaling.Scale(pictureBoxFilesCount.Height)); + + labelFoldersCount.Font = new Font("Segoe UI", 7F * Scaling.Factor, FontStyle.Bold, GraphicsUnit.Point, (byte)0); + labelFilesCount.Font = new Font("Segoe UI", 7F * Scaling.Factor, FontStyle.Bold, GraphicsUnit.Point, (byte)0); + // tableLayoutPanelDgvAndScrollbar.ResumeLayout(false); // ((System.ComponentModel.ISupportInitialize)dgv).EndInit(); // tableLayoutPanelSearch.ResumeLayout(false); diff --git a/UserInterface/Menu.Designer.cs b/UserInterface/Menu.Designer.cs index 0cc0be8..07c5ce3 100644 --- a/UserInterface/Menu.Designer.cs +++ b/UserInterface/Menu.Designer.cs @@ -34,8 +34,12 @@ this.tableLayoutPanelDgvAndScrollbar = new System.Windows.Forms.TableLayoutPanel(); this.dgv = new System.Windows.Forms.DataGridView(); this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel(); + this.labelFilesCount = new System.Windows.Forms.Label(); this.textBoxSearch = new System.Windows.Forms.TextBox(); this.pictureBoxSearch = new System.Windows.Forms.PictureBox(); + this.pictureBoxFilesCount = new System.Windows.Forms.PictureBox(); + this.pictureBoxFoldersCount = new System.Windows.Forms.PictureBox(); + this.labelFoldersCount = new System.Windows.Forms.Label(); this.tableLayoutPanelMenu = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanelTitle = new System.Windows.Forms.TableLayoutPanel(); this.pictureBoxOpenFolder = new System.Windows.Forms.PictureBox(); @@ -44,6 +48,8 @@ ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.tableLayoutPanelSearch.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFilesCount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFoldersCount)).BeginInit(); this.tableLayoutPanelMenu.SuspendLayout(); this.tableLayoutPanelTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxOpenFolder)).BeginInit(); @@ -106,20 +112,39 @@ this.tableLayoutPanelSearch.AutoSize = true; this.tableLayoutPanelSearch.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanelSearch.BackColor = System.Drawing.Color.White; - this.tableLayoutPanelSearch.ColumnCount = 2; + this.tableLayoutPanelSearch.ColumnCount = 6; + this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelSearch.Controls.Add(this.labelFilesCount, 5, 0); this.tableLayoutPanelSearch.Controls.Add(this.textBoxSearch, 1, 0); this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxSearch, 0, 0); + this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxFilesCount, 4, 0); + this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxFoldersCount, 2, 0); + this.tableLayoutPanelSearch.Controls.Add(this.labelFoldersCount, 3, 0); this.tableLayoutPanelSearch.Location = new System.Drawing.Point(0, 63); 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(83, 22); + this.tableLayoutPanelSearch.Size = new System.Drawing.Size(129, 22); this.tableLayoutPanelSearch.TabIndex = 5; this.tableLayoutPanelSearch.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); // + // labelFilesCount + // + this.labelFilesCount.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.labelFilesCount.AutoSize = true; + this.labelFilesCount.Location = new System.Drawing.Point(104, 3); + this.labelFilesCount.Margin = new System.Windows.Forms.Padding(0); + this.labelFilesCount.Name = "labelFilesCount"; + this.labelFilesCount.Size = new System.Drawing.Size(25, 15); + this.labelFilesCount.TabIndex = 2; + this.labelFilesCount.Text = "999"; + // // textBoxSearch // this.textBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -130,7 +155,7 @@ 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.Size = new System.Drawing.Size(15, 15); this.textBoxSearch.TabIndex = 0; this.textBoxSearch.TextChanged += new System.EventHandler(this.TextBoxSearch_TextChanged); // @@ -147,6 +172,45 @@ this.pictureBoxSearch.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxSearch_Paint); this.pictureBoxSearch.Resize += new System.EventHandler(this.PictureBox_Resize); // + // pictureBoxFilesCount + // + this.pictureBoxFilesCount.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.pictureBoxFilesCount.BackColor = System.Drawing.Color.White; + this.pictureBoxFilesCount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pictureBoxFilesCount.Location = new System.Drawing.Point(86, 2); + this.pictureBoxFilesCount.Margin = new System.Windows.Forms.Padding(0); + this.pictureBoxFilesCount.Name = "pictureBoxFilesCount"; + this.pictureBoxFilesCount.Size = new System.Drawing.Size(18, 18); + this.pictureBoxFilesCount.TabIndex = 1; + this.pictureBoxFilesCount.TabStop = false; + this.pictureBoxFilesCount.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxFilesCount_Paint); + this.pictureBoxFilesCount.Resize += new System.EventHandler(this.PictureBox_Resize); + // + // pictureBoxFoldersCount + // + this.pictureBoxFoldersCount.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.pictureBoxFoldersCount.BackColor = System.Drawing.Color.White; + this.pictureBoxFoldersCount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.pictureBoxFoldersCount.Location = new System.Drawing.Point(43, 2); + this.pictureBoxFoldersCount.Margin = new System.Windows.Forms.Padding(0); + this.pictureBoxFoldersCount.Name = "pictureBoxFoldersCount"; + this.pictureBoxFoldersCount.Size = new System.Drawing.Size(18, 18); + this.pictureBoxFoldersCount.TabIndex = 1; + this.pictureBoxFoldersCount.TabStop = false; + this.pictureBoxFoldersCount.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxFoldersCount_Paint); + this.pictureBoxFoldersCount.Resize += new System.EventHandler(this.PictureBox_Resize); + // + // labelFoldersCount + // + this.labelFoldersCount.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.labelFoldersCount.AutoSize = true; + this.labelFoldersCount.Location = new System.Drawing.Point(61, 3); + this.labelFoldersCount.Margin = new System.Windows.Forms.Padding(0); + this.labelFoldersCount.Name = "labelFoldersCount"; + this.labelFoldersCount.Size = new System.Drawing.Size(25, 15); + this.labelFoldersCount.TabIndex = 2; + this.labelFoldersCount.Text = "999"; + // // tableLayoutPanelMenu // this.tableLayoutPanelMenu.AutoSize = true; @@ -163,7 +227,7 @@ 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(83, 85); + this.tableLayoutPanelMenu.Size = new System.Drawing.Size(129, 85); this.tableLayoutPanelMenu.TabIndex = 4; this.tableLayoutPanelMenu.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel); // @@ -183,7 +247,7 @@ 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, 22); + this.tableLayoutPanelTitle.Size = new System.Drawing.Size(129, 22); this.tableLayoutPanelTitle.TabIndex = 5; // // pictureBoxOpenFolder @@ -206,7 +270,7 @@ // this.pictureBoxMenuAlwaysOpen.BackColor = System.Drawing.Color.Transparent; this.pictureBoxMenuAlwaysOpen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(62, 1); + this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(108, 1); this.pictureBoxMenuAlwaysOpen.Margin = new System.Windows.Forms.Padding(1); this.pictureBoxMenuAlwaysOpen.Name = "pictureBoxMenuAlwaysOpen"; this.pictureBoxMenuAlwaysOpen.Size = new System.Drawing.Size(20, 20); @@ -246,6 +310,8 @@ this.tableLayoutPanelSearch.ResumeLayout(false); this.tableLayoutPanelSearch.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFilesCount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFoldersCount)).EndInit(); this.tableLayoutPanelMenu.ResumeLayout(false); this.tableLayoutPanelMenu.PerformLayout(); this.tableLayoutPanelTitle.ResumeLayout(false); @@ -270,5 +336,9 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanelTitle; private System.Windows.Forms.PictureBox pictureBoxOpenFolder; private System.Windows.Forms.PictureBox pictureBoxMenuAlwaysOpen; + private System.Windows.Forms.Label labelFilesCount; + private System.Windows.Forms.PictureBox pictureBoxFilesCount; + private System.Windows.Forms.PictureBox pictureBoxFoldersCount; + private System.Windows.Forms.Label labelFoldersCount; } } \ No newline at end of file diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index e1dd472..c9f7dbb 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -85,6 +85,9 @@ namespace SystemTrayMenu.UserInterface foreColor = Color.White; labelTitle.ForeColor = foreColor; textBoxSearch.ForeColor = foreColor; + ColorConverter colorConverter = new ColorConverter(); + labelFoldersCount.ForeColor = (Color)colorConverter.ConvertFromString("#585858"); + labelFilesCount.ForeColor = (Color)colorConverter.ConvertFromString("#585858"); titleBackColor = AppColors.DarkModeTitle; backColor = AppColors.DarkModeBackground; backColorSearch = AppColors.DarkModeSearchField; @@ -100,6 +103,8 @@ namespace SystemTrayMenu.UserInterface dgv.BackgroundColor = backColor; textBoxSearch.BackColor = backColorSearch; pictureBoxSearch.BackColor = backColorSearch; + pictureBoxFoldersCount.BackColor = backColorSearch; + pictureBoxFilesCount.BackColor = backColorSearch; tableLayoutPanelSearch.BackColor = backColorSearch; dgv.DefaultCellStyle = new DataGridViewCellStyle { @@ -607,7 +612,9 @@ namespace SystemTrayMenu.UserInterface string filterField = dgv.Columns[1].Name; SearchTextChanging?.Invoke(); - string searchString = textBoxSearch.Text.Trim(); + string searchString = textBoxSearch.Text.Trim() + .Replace("%", " ") + .Replace("*", " "); string like = string.Empty; string[] splittedParts = searchString.Split(" "); if (splittedParts.Length > 1) @@ -670,12 +677,26 @@ namespace SystemTrayMenu.UserInterface data.DefaultView.Sort = columnSortIndex; } + int foldersCount = 0; + int filesCount = 0; + foreach (DataGridViewRow row in dgv.Rows) { RowData rowData = (RowData)row.Cells[2].Value; rowData.RowIndex = row.Index; + + if (rowData.ContainsMenu) + { + foldersCount++; + } + else + { + filesCount++; + } } + SetCounts(foldersCount, filesCount); + SearchTextChanged.Invoke(this, null); } @@ -705,6 +726,18 @@ namespace SystemTrayMenu.UserInterface e.Graphics.DrawImage(Config.BitmapSearch, new Rectangle(Point.Empty, pictureBox.ClientSize)); } + private void PictureBoxFoldersCount_Paint(object sender, PaintEventArgs e) + { + PictureBox pictureBox = (PictureBox)sender; + e.Graphics.DrawImage(Config.BitmapFoldersCount, new Rectangle(Point.Empty, pictureBox.ClientSize)); + } + + private void PictureBoxFilesCount_Paint(object sender, PaintEventArgs e) + { + PictureBox pictureBox = (PictureBox)sender; + e.Graphics.DrawImage(Config.BitmapFilesCount, new Rectangle(Point.Empty, pictureBox.ClientSize)); + } + private void PictureBoxMenuAlwaysOpen_Paint(object sender, PaintEventArgs e) { PictureBox pictureBox = (PictureBox)sender; @@ -752,5 +785,11 @@ namespace SystemTrayMenu.UserInterface UserClickedOpenFolder?.Invoke(); } } + + internal void SetCounts(int foldersCount, int filesCount) + { + labelFoldersCount.Text = foldersCount.ToString(); + labelFilesCount.Text = filesCount.ToString(); + } } } \ No newline at end of file