【问题标题】:AutoHotKey GUI with embedded HTML and transparent background具有嵌入式 HTML 和透明背景的 AutoHotKey GUI
【发布时间】:2016-08-30 05:01:24
【问题描述】:

我正在尝试使用以下代码制作一个 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,
    (
<!DOCTYPE html>
<html>
  <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge"/>
  <head>
    <style type="text/css">
    body {
      background-color: transparent;
      overflow:hidden;
    }
    #header1 {
      color:blue;
    }
    </style>
  </head>
  <body>
    <div id="header1">TEST</div>
    <img src="http://i.stack.imgur.com/FBZq5.png" />
  </body>
</html>
), overlay.html
return

除了透明度之外的一切都很好。我可以使用 WinSet Transparent 使整个控件透明,但我想要的只是覆盖的边缘淡出为透明,以便 HTML 的实际内容可见。

我为 HTML 创建了一个背景图像,具有所需的淡入透明效果,但由于 HTML 的背景仍然是白色的,所以它只是淡入淡出到白色。

似乎是 IE 不想呈现透明背景的问题?有什么办法可以解决这个问题,使背景真正透明,还是有其他可能的解决方法?

【问题讨论】:

    标签: html css internet-explorer activex autohotkey


    【解决方案1】:

    This script 显示具有透明度的控件:

    这与 TransColor。其他设置可用。

    【讨论】:

      【解决方案2】:

      我试图弄清楚同样的事情。我精通 html、css、javascript、coffeescript、scss 和其他一些涉及网页设计等的语言。以我的经验,我唯一能让网页具有透明背景的地方是电子。我一直在用中子做实验。它是一个像电子一样的渲染器,但适用于 ahk。我建议去那里看看。如果你发现什么让我知道。 Neutron for ahk 可以在 geek dude 制作的 github 上找到。这是一个网络研讨会。应该有指向它的链接。 https://www.youtube.com/watch?v=cTRcOG28hYI

      【讨论】:

      • 如果电子可以做到,我确定有办法做到这一点。这只是试验和希望的问题。如果我有什么想法,我会告诉你的
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-31
      • 2011-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多