为 Shell.Explorer 控件启用 DPI.ahk
; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=80250 Gui, Add, ActiveX, w400 h200 vwb, Shell.Explorer Gui, Add, Checkbox, cBlue visEnabled gToggleDPI, Enable IE DPI Gui, Show wb.navigate("about:<!DOCTYPE html><meta http-equiv='X-UA-Compatible' content='IE=edge'>") while wb.Busy sleep, 10 wb.document.write( HtmlCode() ) ;if __IsIeDpiEnabled() if (wb.document.parentWindow.devicePixelRatio > 1) GuiControl,, isEnabled, 1 Return ToggleDPI: GuiControlGet, isEnabled EnableIeDpi(isEnabled) Reload Return GuiClose: ExitApp EnableIeDpi(bEnable := true, exeName := "") { if (exeName = "") exeName := A_IsCompiled ? A_ScriptName : RegExReplace(A_AhkPath, ".*\\") keyName := "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_96DPI_PIXEL" RegRead, v, %keyName%, %exeName% if (v != bEnable) RegWrite, REG_DWORD, %keyName%, %exeName%, %bEnable% } __IsIeDpiEnabled() { keyName := "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_96DPI_PIXEL" exeName := A_IsCompiled ? A_ScriptName : RegExReplace(A_AhkPath, ".*\\") RegRead, v, %keyName%, %exeName% Return (v = 1) } HtmlCode() { s = ( <!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <style type="text/css">*{margin:5px;padding:0px;} body { overflow: hidden; }</style> </head> <form class="form-horizontal m"> <div class="form-group"> <label class="col-sm-2 control-label">Label 1:</label> <div class="col-sm-4"> <input class="form-control" readonly="true" value="Input 1"> </div> <br> </div> <div class="form-group"> <label class="col-sm-2 control-label">Label 2:</label> <div class="col-sm-4"> <input class="form-control" readonly="true" value="Input 2"> </div> </div> </form> </body> </html> ) return s }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)