Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 546

PowerShell GUIs • Re: Close form on Escape Key

$
0
0

Code:

$form1_KeyDown=[System.Windows.Forms.KeyEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
#TODO: Place custom script here
If ($_.KeyCode -eq [System.Windows.Forms.Keys]::Escape)
{
$form1.Close()
}
}
This is checking for the escape key using Keys enum class. You can find more information about that here:
https://learn.microsoft.com/en-us/dotne ... esktop-8.0

Statistics: Posted by brittneyr — Wed Feb 28, 2024 8:30 am



Viewing all articles
Browse latest Browse all 546

Trending Articles