我正在使用hta文件作为初始屏幕,hta文件打开的图像称为“ Loading1.png”,尺寸为478 x50。在hta文件中设置窗口大小和位置时,图像显示为白色边框,并且偏离中心。
我的代码可能出什么问题了?
<html>
<hta:application id="oHTA"
border="none"
caption="no"
contextmenu="no"
innerborder="no"
scroll="no"
showintaskbar="no"
/>
<script language="VBScript">
Sub Window_OnLoad
'Resize and position the window
width = 478 : height = 50
window.resizeTo width, height
window.moveTo screen.availWidth\2 - width\2, screen.availHeight\2 - height\2
End Sub
</script>
<body>
<table border=0 width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<img src="Loading1.png"/>
</td>
</tr>
</table>
</body>
</html>
我只想在屏幕中央显示我的图像“ Loading1.png”,没有边框或其他任何东西。
答案 0 :(得分:1)
Loading1.png
图片属性:
HTA应用程序(请注意±1像素的精细平衡):
<html>
<HTA:APPLICATION ID = "oHTA"
BORDER = "none"
BORDERSTYLE = "normal"
CAPTION = "no"
CONTEXTMENU = "no"
SYSMENU = "no"
NAVIGABLE = "no"
INNERBORDER = "no"
SCROLL = "no"
SELECTION = "no"
SINGLEINSTANCE = "yes"
WINDOWSTATE = "normal"
SHOWINTASKBAR = "no"
/>
<head>
<meta http-equiv="x-ua-compatible" content="ie=9">
<style type="text/css">
body {
background-color: red; /* ↓↓↓ merely for contrast ↓↓↓ */
border-color: red; /* ↑↑↑ merely for contrast ↑↑↑ */
margin-top: -1px;
margin-left: -1px;
margin-bottom: -1px;
margin-right: -1px;
}
</style>
<script language="VBScript">
Option Explicit
Dim width, height
width = 478 -1 '''
height = 50 -1 '''
Sub window_onload()
CenterWindow width, height
End Sub
Sub CenterWindow( widthX, heightY )
self.ResizeTo widthX, heightY
self.MoveTo (screen.availWidth - widthX)/2, (screen.availHeight - heightY)/2
End Sub
</script>
</head>
<body>
<img src="Loading1.png"/>
</body>
</html>
结果(白色背景):
结果(黑色背景):