国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

定制 WebBrowser 控件

2024-07-21 02:24:09
字體:
供稿:網(wǎng)友
因為工作需要,這幾天在尋找定制 webbrowser 控件的方法。原來已經(jīng)研究過一陣子,原理大概知道,
基本就是實現(xiàn) idochostuihandler 和 idochostshowui 兩個接口,ie 控件會在適當?shù)臅r候調(diào)用這兩個接口,
我只要按照幫助文檔的說明設置不同的值就可以了。

掛接這兩個接口接口到控件中去,有兩種方法:
一種是通過 icustomdoc 接口定制,代碼如下:
html0.navigate2("about:blank");
icustomdoc o = html0.document as icustomdoc;
o.setuihandler(this as idochostuihandler);
但是因為只有文檔裝入之后才可以取得document的值,所以需要預先裝入一個空文檔,這里是about:blank。

第二種方法是完成 active document host 所需要的所有接口
, ioleclientsite
, ioleinplacesite
, ioledocumentsite
//, iolewindow // ioleinplacesite 已經(jīng)包含了該接口
, idochostuihandler
, idochostshowui

// ioleinplacesite.getwindowcontext 調(diào)用需要以下兩個接口
, ioleinplaceframe
//, ioleinplaceuiwindow // ioleinplaceframe 已經(jīng)實現(xiàn)了該接口

// 接口 ioleclientsite.getcontainor 需要用到
, iolecontainer

掛接這些接口到控件中的代碼如下:
ioleobject o = html0.getocx() as ioleobject;
o.setclientsite(this as ioleclientsite);
一旦掛接成功之后,一般會調(diào)用如下幾個函數(shù)
ioleinplacesite getwindow
idochostuihandler gethostinfo
idochostuihandler getoptionkeypath
idochostuihandler gethostinfo
idochostuihandler getdroptarget
idochostuihandler updateui
idochostuihandler showui
idochostuihandler hideui
idochostuihandler translateaccelerator
idochostuihandler translateurl
idochostuihandler showcontextmenu
idochostshowui idochostshowui
ioleclientsite getcontainer

另外還有一種方法,就是直接使用文檔嵌入功能,嵌入 htmldocument 對象,這樣可以省卻使用 webbrowser 控件。htmleditor 就是用的這種方法,可惜我沒能做成。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 唐河县| 哈密市| 镇原县| 哈巴河县| 大城县| 南平市| 交城县| 房山区| 香格里拉县| 广饶县| 阳西县| 海晏县| 昌图县| 怀安县| 文成县| 苍山县| 光泽县| 富平县| 上蔡县| 湘阴县| 娱乐| 太白县| 夏邑县| 渝中区| 郓城县| 宝坻区| 湖口县| 三穗县| 尚义县| 敦煌市| 苗栗县| 巫山县| 鄂伦春自治旗| 买车| 周口市| 双柏县| 扎兰屯市| 榆林市| 嘉黎县| 汶川县| 安塞县|