Vbscript 将图像作为输入框的背景
我想在Vbscript 将图像作为输入框的背景,vbscript,inputbox,Vbscript,Inputbox,我想在msgbox中放置一个图像。在我搜索它之后,我发现这是不可能的,所以我决定把图像放在msgbox上输入框的背景中。但我找不到该怎么做: 将图像作为输入框的背景 自定义输入框,如删除边框和更改背景色 内置函数不支持自定义背景。您可以使用构建自定义对话框,但: 这样,您就不必为背景引用外部文件。例如,可以使用免费的在线编码器将图像文件编码为base64。可能使用Javascript。我想在vbs文件上使用它。然后我敢肯定你运气不好。VBScript并不是一种功能强大的语言。 Set ie =
msgbox
中放置一个图像。在我搜索它之后,我发现这是不可能的,所以我决定把图像放在msgbox
上输入框的背景中。但我找不到该怎么做:
这样,您就不必为背景引用外部文件。例如,可以使用免费的在线编码器将图像文件编码为base64。可能使用Javascript。我想在vbs文件上使用它。然后我敢肯定你运气不好。VBScript并不是一种功能强大的语言。
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
ie.document.title = "some title"
ie.ToolBar = False
ie.Resizable = False
ie.StatusBar = False
ie.Width = 300
ie.Height = 150
Set style = ie.document.CreateStyleSheet()
style.AddRule "body", "background-image: url('C:\path\to\your.jpg')"
Set style = Nothing
Do Until ie.ReadyState = 4 : WScript.Sleep 100 : Loop
ie.document.body.innerHtml = "<p><input type='text' id='userinput'></p>" _
& "<p><input type='hidden' id='OK' name='OK' value='0'>" _
& "<input type='submit' value='OK' onClick='VBScript:OK.Value=1'>" _
& "<input type='submit' value='Cancel' onClick='VBScript:OK.Value=-1'></p>"
ie.Visible = True
ie.document.all.userinput.focus
Do While ie.document.all.OK.value = 0 : WScript.Sleep 100 : Loop
If ie.document.all.OK.value = 1 Then
'user pressed [OK]
Else
'user clicked [Cancel]
End If
style.AddRule "body", "background-image: url(data:image/jpeg;base64,/9j/4AA...')