feat(ui): frameless transparent window with drag

This commit is contained in:
2026-08-25 18:05:12 +05:00
parent 26ac5e6003
commit e336cf7e86
8 changed files with 104 additions and 38 deletions
+3
View File
@@ -1,5 +1,6 @@
param(
[string]$Out = "tools/out/app.png",
[switch]$Light,
[switch]$NoBuild
)
@@ -16,7 +17,9 @@ if (-not (Test-Path $exe)) {
exit 1
}
if ($Light) { $env:BP_THEME = "light" }
$proc = Start-Process -FilePath $exe -WorkingDirectory $PWD -PassThru
Remove-Item Env:\BP_THEME -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 1800
& "$PSScriptRoot\shot.ps1" -ProcId $proc.Id -Out $Out
+8 -1
View File
@@ -16,6 +16,8 @@ public class BpWin {
[DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint pid);
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr after, int x, int y, int cx, int cy, uint flags);
[StructLayout(LayoutKind.Sequential)]
public struct RECT { public int Left; public int Top; public int Right; public int Bottom; }
}
@@ -48,6 +50,11 @@ if ($found -eq [IntPtr]::Zero) {
$rect = New-Object BpWin+RECT
[BpWin]::GetWindowRect($found, [ref]$rect) | Out-Null
[BpWin]::SetWindowPos($found, [IntPtr](-1), 0, 0, 0, 0, 0x0003) | Out-Null
[BpWin]::SetForegroundWindow($found) | Out-Null
Start-Sleep -Milliseconds 250
$w = $rect.Right - $rect.Left
$h = $rect.Bottom - $rect.Top
@@ -68,4 +75,4 @@ $outAbs = [System.IO.Path]::GetFullPath((Join-Path $PWD $Out))
$bmp.Save($outAbs, [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
Write-Host "OK $OutAbs (${w}x${h})"
Write-Host "OK $OutAbs (${w}x${h} @ $($rect.Left),$($rect.Top))"