如何通过AutoHotkey的ActiveX控件加载和显示自定义HTML,结合CSS样式来展示富文本内容。通过动态调整控件大小,确保显示内容完全可见。
; https://www.autohotkey.com/boards/viewtopic.php?p=368474#p368474 html = ( <style> body { overflow-x:hidden;overflow-y:hidden; font-family: Microsoft YaHei UI; font-size: 28px; } .red {color: red;} .blue {color: blue;} </style> <body oncontextmenu="return false"> <span class="red">Hello, </span> <span class="blue">World!</span><br> <span class="red">I love </span> AutoHotkey! </body> ) Gui -DPIScale Gui Margin, 0, 0 ; Gui Add, ActiveX, vRichText w300 h100, htmlfile ; RichText.Write(html) ; Gui Show Gui Add, ActiveX, vRichText w300 h1, htmlfile RichText.Write(html) GuiControl, MoveDraw, RichText, % "h" RichText.body.scrollHeight ; 设置为实际内容高度 Gui Show, AutoSize ; 动态设置高度必须要用AutoSize Return GuiClose: ExitApp
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)