NotifyIcon + ContextMenuStrip

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.

This forum is a space to discuss coding involving Graphical User Interfaces (GUI) in PowerShell or using WinForms controls, and technical issues related to development.

- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
Aoemilad
Posts: 3
Last visit: Fri May 19, 2023 11:03 am

NotifyIcon + ContextMenuStrip

Post by Aoemilad »

I made a form in PS Studio with a notify icon and a contextmenustrip for that icon.
The notify icon does nothing more than stay in the system tray in the taskbar and when you right click it give you options to run other scripts. Its like a script hub.
My issue is when I right click it the contextmenustrip appears to the left of the mouse instead of to the right of the mouse like all other contextmenus in other notifyicons like battery and wifi and stuff.
This isn't the biggest issue but because I put my taskbar on the left side of my monitor, the contextmenu appears on my second monitor (to the left of my main one).

Is there a way to make it act like the other contextmenus?

As a workaround I was able to assign the left click to $contextmenustrip.Show() but then the contextmenustrip doesn't disappear when you click elsewhere and it loses focus.

Any help is appreciated!
This topic is 1 year and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked