I want to capture a rightclick event on a listbox and send the text to set-clipboard.
I can't figure out how to test the event if it was a right click, I added the even mouse down, not sure how to
see what is available in the $_ = [System.Windows.Forms.MouseEventArgs] to test if the right mouse button was clicked.
How to capture a rightclick event in a listbox
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.
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.
-
- Posts: 14674
- Joined: Tue May 22, 2007 9:57 am
- Has voted: 1 time
- Been upvoted: 5 times
- Contact:
Re: How to capture a rightclick event in a listbox
Just check the button to see which one was clicked:
Code: Select all
$listbox1_MouseClick=[System.Windows.Forms.MouseEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
Write-Host $_.Button
}