我正在尝试使用以下代码创建一个AutoHotKey脚本来显示来自HTML文件的透明覆盖:
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance, force
Menu Tray, tip, %A_ScriptName% ; Custom traytip
OverlayVisible := 0
; ---------------------- CUSTOMIZE BELOW HERE ----------------------
PositionX := 31 ; x position of top left corner of overlay
PositionY := 423 ; y position of top left corner of overlay
F1::
Gosub Sub_BuildHTML
Gosub Sub_ToggleOverlay
return
Sub_ToggleOverlay:
if !OverlayVisible {
Gosub Sub_ShowOverlay
} else {
Gosub Sub_HideOverlay
}
OverlayVisible := !OverlayVisible
return
; Creates and shows the GUI
Sub_ShowOverlay:
Gui GUI_Overlay:New, +ToolWindow +LastFound +AlwaysOnTop -Caption -Border +hwndGUI_Overlay_hwnd
Gui Margin, 0,0
Gui Add, ActiveX, w400 h225 vWB BackGroundTrans, Shell.Explorer
URL := "file:///" . A_ScriptDir . "/overlay.html"
WB.Navigate(URL)
WinSet Transparent, 255
;WinSet TransColor, White 0
Gui Show, Hide, Overlay
WinMove PositionX, PositionY
Gui GUI_Overlay:Show, NoActivate
return
Sub_HideOverlay:
Gui GUI_Overlay:Destroy
return
Sub_BuildHTML:
FileDelete, overlay.html
FileAppend,
(
body {
background-color: transparent;
overflow:hidden;
}
#header1 {
color:blue;
}
TEST
), overlay.html
return
除了透明度之外,一切都运行得很好。我可以使用HTML来使整个控件透明,但我只想让覆盖的边缘淡出为透明,这样WinSet的实际内容就是可见的。
我为HTML创建了一个背景图像,并将其淡入透明,但由于HTML的背景仍然是白色的,所以它只是一个淡入淡出的白色。
IE不想渲染透明背景似乎是个问题?有没有办法修复这个问题,让背景变得真正透明,或者有没有其他可行的变通办法?
发布于 2019-09-02 22:33:15
此脚本显示具有透明度的控件:
这是关于TransColor的。其他设置也可用。
https://stackoverflow.com/questions/37033113
复制相似问题