用vbs实现选择颜色
程序员文章站
2022-07-04 17:27:43
如果不用组件的话,代码如下: set ie = createobject("internetexplorer.application") ie...
如果不用组件的话,代码如下:
set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
do until ie.readystate = 4 : wscript.sleep 25 : loop
set doc = ie.document
set body = doc.body
set win = doc.parentwindow
body.innerhtml = "<object id=dlg classid='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b'></object>"
body.innertext = doc.getelementbyid("dlg").choosecolordlg
win.clipboarddata.setdata "text", body.innertext
ie.quit
如果用组件的话,代码如下:
flag = 1+2
initialcolor = &hff32ea
color = opencolor(initialcolor, flag)
msgbox "selected color: " & hex(color)
function opencolor(initcolor, flags)
set comdlg = createobject("mscomdlg.commondialog")
comdlg.color = initcolor
comdlg.flags = flags
comdlg.showcolor
opencolor = comdlg.color
end function
组件相关文件下载
set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
do until ie.readystate = 4 : wscript.sleep 25 : loop
set doc = ie.document
set body = doc.body
set win = doc.parentwindow
body.innerhtml = "<object id=dlg classid='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b'></object>"
body.innertext = doc.getelementbyid("dlg").choosecolordlg
win.clipboarddata.setdata "text", body.innertext
ie.quit
如果用组件的话,代码如下:
flag = 1+2
initialcolor = &hff32ea
color = opencolor(initialcolor, flag)
msgbox "selected color: " & hex(color)
function opencolor(initcolor, flags)
set comdlg = createobject("mscomdlg.commondialog")
comdlg.color = initcolor
comdlg.flags = flags
comdlg.showcolor
opencolor = comdlg.color
end function
组件相关文件下载