[Feature] Visual feedback during click (#311), version 1.2.3.6

This commit is contained in:
Markus Hofknecht 2022-02-05 10:32:28 +01:00
parent 95181d34a5
commit 86c0771c3e
7 changed files with 76 additions and 40 deletions

View file

@ -585,6 +585,7 @@ namespace SystemTrayMenu.Handler
RowData rowData = (RowData)row.Cells[2].Value;
rowData.IsSelected = false;
row.Selected = false;
rowData.IsClicking = false;
}
}
}

View file

@ -64,6 +64,7 @@ namespace SystemTrayMenu.Business
{
RowData rowDataToClear = (RowData)row[2];
rowDataToClear.IsMenuOpen = false;
rowDataToClear.IsClicking = false;
rowDataToClear.IsSelected = false;
rowDataToClear.IsContextMenuOpen = false;
}
@ -262,8 +263,9 @@ namespace SystemTrayMenu.Business
}
else if (closedLoadingMenu && menus[0].IsUsable)
{
menuData.RowDataParent.IsSelected = false;
menuData.RowDataParent.IsMenuOpen = false;
menuData.RowDataParent.IsClicking = false;
menuData.RowDataParent.IsSelected = false;
RefreshSelection(menus[menuLoading.Level - 1].GetDataGridView());
}
}
@ -1088,6 +1090,7 @@ namespace SystemTrayMenu.Business
{
RowData rowData = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
rowData.MouseDown(dgv, e);
dgv.InvalidateRow(hitTestInfo.RowIndex);
}
if (e.Button == MouseButtons.Left)
@ -1178,6 +1181,7 @@ namespace SystemTrayMenu.Business
{
RowData trigger = (RowData)dgv.Rows[hitTestInfo.RowIndex].Cells[2].Value;
trigger.DoubleClick(e, out bool toCloseByDoubleClick);
dgv.InvalidateRow(hitTestInfo.RowIndex);
if (toCloseByDoubleClick)
{
MenusFadeOut();
@ -1208,6 +1212,11 @@ namespace SystemTrayMenu.Business
row.DefaultCellStyle.SelectionBackColor = Color.White;
row.Selected = false;
}
else if (rowData.IsClicking)
{
row.DefaultCellStyle.SelectionBackColor = MenuDefines.ColorIcons;
row.Selected = true;
}
else if (rowData.IsContextMenuOpen || (rowData.IsMenuOpen && rowData.IsSelected))
{
row.Selected = true;
@ -1248,7 +1257,12 @@ namespace SystemTrayMenu.Business
int width = dgv.Columns[0].Width + dgv.Columns[1].Width;
Rectangle rowBounds = new(0, e.RowBounds.Top, width, e.RowBounds.Height);
if (rowData.IsContextMenuOpen || (rowData.IsMenuOpen && rowData.IsSelected))
if (rowData.IsClicking)
{
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorIcons, ButtonBorderStyle.Solid);
row.DefaultCellStyle.SelectionBackColor = MenuDefines.ColorSelectedItem;
}
else if (rowData.IsContextMenuOpen || (rowData.IsMenuOpen && rowData.IsSelected))
{
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorSelectedItemBorder, ButtonBorderStyle.Solid);
row.DefaultCellStyle.SelectionBackColor = MenuDefines.ColorSelectedItem;

View file

@ -204,6 +204,7 @@ namespace SystemTrayMenu.Handler
if (rowData != null)
{
rowData.IsSelected = false;
rowData.IsClicking = false;
dgv.Rows[rowIndex].Selected = false;
this.dgv = null;
this.rowIndex = 0;

View file

@ -30,6 +30,8 @@ namespace SystemTrayMenu.DataClasses
internal bool IsMenuOpen { get; set; }
internal bool IsClicking { get; set; }
internal bool IsSelected { get; set; }
internal bool ContainsMenu { get; set; }
@ -142,6 +144,11 @@ namespace SystemTrayMenu.DataClasses
internal void MouseDown(DataGridView dgv, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
IsClicking = true;
}
if (e != null &&
e.Button == MouseButtons.Right &&
FileInfo != null &&
@ -176,6 +183,8 @@ namespace SystemTrayMenu.DataClasses
internal void MouseClick(MouseEventArgs e, out bool toCloseByDoubleClick)
{
IsClicking = false;
toCloseByDoubleClick = false;
if (Properties.Settings.Default.OpenItemWithOneClick)
{
@ -195,6 +204,8 @@ namespace SystemTrayMenu.DataClasses
internal void DoubleClick(MouseEventArgs e, out bool toCloseByDoubleClick)
{
IsClicking = false;
toCloseByDoubleClick = false;
if (!Properties.Settings.Default.OpenItemWithOneClick)
{

View file

@ -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.2.3.5")]
[assembly: AssemblyFileVersion("1.2.3.5")]
[assembly: AssemblyVersion("1.2.3.6")]
[assembly: AssemblyFileVersion("1.2.3.6")]

View file

@ -304,14 +304,14 @@ namespace SystemTrayMenu.UserInterface
this.labelSearchField = new System.Windows.Forms.Label();
this.groupBoxAppearance = new System.Windows.Forms.GroupBox();
this.tableLayoutPanelAppearance = new System.Windows.Forms.TableLayoutPanel();
this.checkBoxRoundCorners = new System.Windows.Forms.CheckBox();
this.buttonAppearanceDefault = new System.Windows.Forms.Button();
this.checkBoxUseFading = new System.Windows.Forms.CheckBox();
this.checkBoxDarkModeAlwaysOn = new System.Windows.Forms.CheckBox();
this.checkBoxRoundCorners = new System.Windows.Forms.CheckBox();
this.tableLayoutPanelBottom = new System.Windows.Forms.TableLayoutPanel();
this.buttonOk = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.colorDialog = new System.Windows.Forms.ColorDialog();
this.checkBoxUseFading = new System.Windows.Forms.CheckBox();
this.buttonAppearanceDefault = new System.Windows.Forms.Button();
this.tableLayoutPanelMain.SuspendLayout();
this.tabControl.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
@ -4315,16 +4315,29 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelAppearance.Size = new System.Drawing.Size(379, 106);
this.tableLayoutPanelAppearance.TabIndex = 1;
//
// checkBoxRoundCorners
// buttonAppearanceDefault
//
this.checkBoxRoundCorners.AutoSize = true;
this.checkBoxRoundCorners.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkBoxRoundCorners.Location = new System.Drawing.Point(3, 3);
this.checkBoxRoundCorners.Name = "checkBoxRoundCorners";
this.checkBoxRoundCorners.Size = new System.Drawing.Size(373, 19);
this.checkBoxRoundCorners.TabIndex = 4;
this.checkBoxRoundCorners.Text = "checkBoxRoundCorners";
this.checkBoxRoundCorners.UseVisualStyleBackColor = true;
this.buttonAppearanceDefault.AutoSize = true;
this.buttonAppearanceDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonAppearanceDefault.Location = new System.Drawing.Point(3, 78);
this.buttonAppearanceDefault.MinimumSize = new System.Drawing.Size(75, 23);
this.buttonAppearanceDefault.Name = "buttonAppearanceDefault";
this.buttonAppearanceDefault.Size = new System.Drawing.Size(154, 25);
this.buttonAppearanceDefault.TabIndex = 3;
this.buttonAppearanceDefault.Text = "buttonAppearanceDefault";
this.buttonAppearanceDefault.UseVisualStyleBackColor = true;
this.buttonAppearanceDefault.Click += new System.EventHandler(this.ButtonAppearanceDefault_Click);
//
// checkBoxUseFading
//
this.checkBoxUseFading.AutoSize = true;
this.checkBoxUseFading.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkBoxUseFading.Location = new System.Drawing.Point(3, 28);
this.checkBoxUseFading.Name = "checkBoxUseFading";
this.checkBoxUseFading.Size = new System.Drawing.Size(373, 19);
this.checkBoxUseFading.TabIndex = 5;
this.checkBoxUseFading.Text = "checkBoxUseFading";
this.checkBoxUseFading.UseVisualStyleBackColor = true;
//
// checkBoxDarkModeAlwaysOn
//
@ -4338,6 +4351,17 @@ namespace SystemTrayMenu.UserInterface
this.checkBoxDarkModeAlwaysOn.UseVisualStyleBackColor = true;
this.checkBoxDarkModeAlwaysOn.CheckedChanged += new System.EventHandler(this.CheckBoxDarkModeAlwaysOnCheckedChanged);
//
// checkBoxRoundCorners
//
this.checkBoxRoundCorners.AutoSize = true;
this.checkBoxRoundCorners.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkBoxRoundCorners.Location = new System.Drawing.Point(3, 3);
this.checkBoxRoundCorners.Name = "checkBoxRoundCorners";
this.checkBoxRoundCorners.Size = new System.Drawing.Size(373, 19);
this.checkBoxRoundCorners.TabIndex = 4;
this.checkBoxRoundCorners.Text = "checkBoxRoundCorners";
this.checkBoxRoundCorners.UseVisualStyleBackColor = true;
//
// tableLayoutPanelBottom
//
this.tableLayoutPanelBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
@ -4386,30 +4410,6 @@ namespace SystemTrayMenu.UserInterface
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// checkBoxUseFading
//
this.checkBoxUseFading.AutoSize = true;
this.checkBoxUseFading.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkBoxUseFading.Location = new System.Drawing.Point(3, 28);
this.checkBoxUseFading.Name = "checkBoxUseFading";
this.checkBoxUseFading.Size = new System.Drawing.Size(373, 19);
this.checkBoxUseFading.TabIndex = 5;
this.checkBoxUseFading.Text = "checkBoxUseFading";
this.checkBoxUseFading.UseVisualStyleBackColor = true;
//
// buttonAppearanceDefault
//
this.buttonAppearanceDefault.AutoSize = true;
this.buttonAppearanceDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonAppearanceDefault.Location = new System.Drawing.Point(3, 78);
this.buttonAppearanceDefault.MinimumSize = new System.Drawing.Size(75, 23);
this.buttonAppearanceDefault.Name = "buttonAppearanceDefault";
this.buttonAppearanceDefault.Size = new System.Drawing.Size(154, 25);
this.buttonAppearanceDefault.TabIndex = 3;
this.buttonAppearanceDefault.Text = "buttonAppearanceDefault";
this.buttonAppearanceDefault.UseVisualStyleBackColor = true;
this.buttonAppearanceDefault.Click += new System.EventHandler(this.ButtonAppearanceDefault_Click);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);

View file

@ -66,6 +66,15 @@
<metadata name="ColumnOnlyFiles.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnFolder.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnRecursiveLevel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnOnlyFiles.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>