fix: CV 视觉组件截屏脚本补加载 System.Windows.Forms
- grabScreen 只 Add-Type 了 System.Drawing, 引用 Windows.Forms.Screen 却未加载该程序集 - 导致 PrimaryScreen.Bounds 取值为 Null, 截屏链路 InvokeMethodOnNull, 所有 CV_* 组件运行失败 - 与 remaining-core.ts 中正常工作的同款脚本对齐
This commit is contained in:
parent
f9b980ab5c
commit
f0b9d1beec
@ -27,6 +27,7 @@ async function grabScreen(imagePath: string): Promise<void> {
|
||||
fs.mkdirSync(path.dirname(imagePath), { recursive: true });
|
||||
const psScript = [
|
||||
"Add-Type -AssemblyName System.Drawing | Out-Null;",
|
||||
"Add-Type -AssemblyName System.Windows.Forms | Out-Null;",
|
||||
"$b = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds;",
|
||||
"$bmp = New-Object System.Drawing.Bitmap($b.Width, $b.Height);",
|
||||
"$g = [System.Drawing.Graphics]::FromImage($bmp);",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user