Skip to content

Commit

Permalink
[Feature] Refresh root folder on change of contents (#330, #399, #400)…
Browse files Browse the repository at this point in the history
…, version 1.2.9.21
  • Loading branch information
Hofknecht committed Jun 18, 2022
1 parent 7c253fa commit e4c297e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
// 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.2.9.20")]
[assembly: AssemblyFileVersion("1.2.9.20")]
[assembly: AssemblyVersion("1.2.9.21")]
[assembly: AssemblyFileVersion("1.2.9.21")]
10 changes: 7 additions & 3 deletions UserInterface/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ namespace SystemTrayMenu.UserInterface

internal partial class Menu : Form
{
public const string RowFilterShowAll = "[SortIndex] LIKE '%0%'";
private const int CornerRadius = 20;
private const string RowFilterShowAll = "[SortIndex] LIKE '%0%'";
private readonly Fading fading = new();
private bool isShowing;
private bool directionToRight;
private int rotationAngle;
private bool mouseDown;
private Point lastLocation;
private bool isSetSearchText;
private bool dgvHeightSet;

internal Menu()
{
Expand Down Expand Up @@ -778,10 +779,10 @@ private void AdjustDataGridViewHeight(Menu menuPredecessor, int screenHeightMax)
ScrollbarVisible = false;
}

if (string.IsNullOrEmpty(textBoxSearch.Text) &&
dgv.Height != dgvHeightNew)
if (!dgvHeightSet)
{
dgv.Height = dgvHeightNew;
dgvHeightSet = true;
}
}

Expand Down Expand Up @@ -830,6 +831,9 @@ private void AdjustDataGridViewWidth()
FontStyle.Regular,
GraphicsUnit.Point,
0);

DataTable dataTable = (DataTable)dgv.DataSource;
dataTable.DefaultView.RowFilter = RowFilterShowAll;
}

private void DgvMouseWheel(object sender, MouseEventArgs e)
Expand Down
9 changes: 5 additions & 4 deletions Utilities/DataGridViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace SystemTrayMenu.Utilities
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using SystemTrayMenu.DataClasses;

internal static class DataGridViewExtensions
{
Expand All @@ -22,13 +23,13 @@ internal static void FastAutoSizeColumns(this DataGridView dgv)
System.Collections.Generic.IEnumerable<DataGridViewRow> rows =
dgv.Rows.Cast<DataGridViewRow>();
using Graphics gfx = dgv.CreateGraphics();
int i = 1;
gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
float widthMax = WidthMin;
foreach (DataGridViewRow row in rows)
DataTable data = (DataTable)dgv.DataSource;
foreach (DataRow row in data.Rows)
{
float checkWidth = gfx.MeasureString(
row.Cells[i].Value.ToString() + "___",
((RowData)row[2]).Text + "___",
dgv.RowTemplate.DefaultCellStyle.Font).Width;
if (checkWidth > widthMax)
{
Expand All @@ -41,7 +42,7 @@ internal static void FastAutoSizeColumns(this DataGridView dgv)
widthMax = Properties.Settings.Default.MaximumMenuWidth;
}

dgv.Columns[i].Width = (int)(widthMax + 0.5);
dgv.Columns[1].Width = (int)(widthMax + 0.5);
string stringWithWidthLikeIcon = "____";
float width0 = gfx.MeasureString(
stringWithWidthLikeIcon,
Expand Down

0 comments on commit e4c297e

Please sign in to comment.