在 WinForms PictureBox PowerShell 中选择像素

问题描述 投票:0回答:1

我使用 PowerShell 开发一个程序,并像标准油漆一样组装 Windows 窗体。我可以加载图像并对其进行编辑,但我想添加一个新工具:单击图片后,我想在文本框中显示所选像素的坐标。

问题是如何从选定的像素中获取坐标?

感谢您的帮助!

powershell
1个回答
5
投票

PictureBox
类继承a
MouseClick
事件
您可以订阅:

$pictureBox.add_MouseClick({
  param($sender, $mouseEventArgs)

  Write-Host "PictureBox was clicked at location $($mouseEventArgs.Location)"
})
© www.soinside.com 2019 - 2024. All rights reserved.