I develop a program with PowerShell and the assembly Windows Forms like the standard paint. I can load images and edit it, but I want to add a new tool: After clicking on the picture, I want to display the co-ordinates of the selected pixel in a TextBox.
The problem is how to get the co-ordinates from the selected pixel?
Thanks for your help!
CodePudding user response:
The PictureBox
class inherits a MouseClick
event you can subscribe to:
$pictureBox.add_MouseClick({
param($sender, $mouseEventArgs)
Write-Host "PictureBox was clicked at location $($mouseEventArgs.Location)"
})