Skip to content

Commit

Permalink
boost(quickmenu): Make quick menu rounded like banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Aug 3, 2022
1 parent 4358c88 commit fd421aa
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions SoundSwitch.UI.Menu/Form/QuickMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using SoundSwitch.UI.Menu.Component;
using SoundSwitch.UI.Menu.Util;
using SoundSwitch.UI.Menu.Util.Timer;

namespace SoundSwitch.UI.Menu.Form
Expand All @@ -30,26 +31,12 @@ public record MenuClickedEvent(IconMenuItem<T>.DataContainer Item);
public event EventHandler<MenuClickedEvent> SelectionChanged;

protected override bool ShowWithoutActivation => true;

/// <summary>
/// Override the parameters used to create the window handle.
/// Ensure that the window will be top-most and do not activate or take focus.
/// </summary>
protected override CreateParams CreateParams
{
get
{
CreateParams p = base.CreateParams;
// p.ExStyle |= 0x08000000; // WS_EX_NOACTIVATE
p.ExStyle |= 0x00000008; // WS_EX_TOPMOST
return p;
}
}


internal QuickMenu()
{
InitializeComponent();
_hideDisposeMethod = HideDispose;
TopMost = true;
}

/// <summary>
Expand Down Expand Up @@ -116,6 +103,7 @@ public void SetData(IEnumerable<IconMenuItem<T>.DataContainer> payloads)

if (!_isLocationSet)
{
Region = Region.FromHrgn(RoundedCorner.CreateRoundRectRgn(0, 0, Width, Height , 20, 20));
Show();
SetLocationToCursor();
_isLocationSet = true;
Expand Down

0 comments on commit fd421aa

Please sign in to comment.