title: How to change the button border when selected in Powershell?
body: <p>I have gui with windows form and have some button. I would like to change the button border once the button selected or the arrow key on keyboard point to the button.
  Is that possible? Thank you for the advice. Thanks a lot</p>
  <p>Here is what I tried:
  So far the border color only change if the mouse cursor point to the button, but if I use arrow key keyboard, it's not change</p>
  <pre><code>Add-Type -AssemblyName System.Windows.Forms
  
  #Form
  $form = New-Object System.Windows.Forms.Form
  $form.Size = &quot;300,100&quot;
  $form.StartPosition = &quot;centerscreen&quot;
  $form.Text = &quot;  Test MouseHover&quot;
  
  #Button
  $ButtonA = New-Object System.Windows.Forms.Button
  $ButtonA.Location = &quot;100,18&quot;
  $ButtonA.Size = &quot;80,30&quot;
  $ButtonA.Text  =　&quot;MouseHover&quot;
  $ButtonA.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
        $ButtonA.Add_MouseEnter({
             $ButtonA.FlatAppearance.BorderSize = 2
             $ButtonA.FlatAppearance.BorderColor = [System.Drawing.ColorTranslator]::FromHtml($Red)})
        $ButtonA.Add_MouseLeave({
             $ButtonA.FlatAppearance.BorderSize = 2
             $ButtonA.FlatAppearance.BorderColor = [System.Drawing.ColorTranslator]::FromHtml(&quot;#ECECEC&quot;)})
  
  $form.Controls.Add($ButtonA);
  $form.Showdialog()
  </code></pre>