ExtPB.Net的WebBrowser控件实际就是我们在C#的C/S设计中使用的同样控件,只是有些属性做了取舍。其中有个ExecWB命令,其格式是:
this.ExecWB = function (cmdID, cmdexecopt, pvaIn) {
if (self.webBrowser != null)
return self.webBrowser.ExecWB(cmdID, cmdexecopt, pvaIn);
}
这里的三个参数定义如下:
(a) cmdID
OLECMDID_OPEN = 1,
OLECMDID_NEW = 2,
OLECMDID_SAVE = 3,
OLECMDID_SAVEAS = 4,
OLECMDID_SAVECOPYAS = 5,
OLECMDID_PRINT = 6,
OLECMDID_PRINTPREVIEW = 7,
OLECMDID_PAGESETUP = 8,
OLECMDID_SPELL = 9,
OLECMDID_PROPERTIES = 10,
OLECMDID_CUT = 11,
OLECMDID_COPY = 12,
OLECMDID_PASTE = 13,
OLECMDID_PASTESPECIAL = 14,
OLECMDID_UNDO = 15,
OLECMDID_REDO = 16,
OLECMDID_selectALL = 17,
OLECMDID_CLEARselectION = 18,
OLECMDID_ZOOM = 19,
OLECMDID_GETZOOMRANGE = 20
OLECMDID_updateCOMMANDS = 21
OLECMDID_REFRESH = 22
OLECMDID_STOP = 23
OLECMDID_HIDETOOLBARS = 24
OLECMDID_SETPROGRESSMAX = 25
OLECMDID_SETPROGRESSPOS = 26
OLECMDID_SETPROGRESSTEXT = 27
OLECMDID_SETTITLE = 28
OLECMDID_SETDOWNLOADSTATE = 29
OLECMDID_STOPDOWNLOAD = 30
我们直接使用整数值即可
(b) cmdexecopt
OLECMDEXECOPT_DODEFAULT = 0,
OLECMDEXECOPT_PROMPTUSER = 1,
LECMDEXECOPT_DONTPROMPTUSER = 2,
OLECMDEXECOPT_SHOWHELP = 3
这个参数﹐选1 即可
(c) pvaIn
可选参数, 不用即可
(d) 例如
.ExecWB(1,1) 打开
.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
.ExecWB(4,1) 保存网页
.ExecWB(6,1) 打印
.ExecWB(7,1) 打印预览
.ExecWB(8,1) 打印页面设置
.ExecWB(10,1) 查看页面属性
.ExecWB(15,1) 好像是撤销,有待确认
.ExecWB(17,1) 全选
.ExecWB(22,1) 刷新
.ExecWB(45,1) 关闭窗体无提示
阅读(3151) | 评论(0) | 转发(0) |