Search code examples
eventspowershellpictureboxmousehover

Windows Forms - Powershell - MouseHover event on PictureBox/TextBox


I made a GUI using windows forms. Just wondering if it is possible to add a mousehover event for picture boxes (New-Object System.Windows.Forms.PictureBox).

A quick workaround I had made is to create invisible buttons where the picture boxes are and add .add_mousehover and .add_mouseleave events on that button. Rather messy, really.

Any ideas?


Solution

  • You can add the add_mousehover tho your System.Windows.Forms.PictureBox object.

    $test = {MSG * 1}
    $pictureBox1 = New-Object System.Windows.Forms.PictureBox
    $pictureBox1.add_mousehover($test)