如何使用 HTML 应用程序只显示居中图像?
How to use HTML application to display only centered image?
我正在使用 hta 文件作为初始屏幕,hta 文件打开的图像称为 "Loading1.png",大小为 478 x 50。在 hta 文件中设置 window 大小和位置时, 图片显示有白色边框并且偏离中心。
我的代码可能有什么问题?
<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 - width, screen.availHeight - height
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",没有边框或其他任何东西。
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>
结果(白色背景):
结果(黑色背景):
我正在使用 hta 文件作为初始屏幕,hta 文件打开的图像称为 "Loading1.png",大小为 478 x 50。在 hta 文件中设置 window 大小和位置时, 图片显示有白色边框并且偏离中心。
我的代码可能有什么问题?
<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 - width, screen.availHeight - height
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",没有边框或其他任何东西。
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>
结果(白色背景):
结果(黑色背景):