天天看點

open-webkit-sharp使用

Html5 windows本地化程式方案–open-webkit-sharp

項目基于WebKit.NET 0.5開發

google code位址:​​​https://code.google.com/archive/p/open-webkit-sharp/​​​

github網址 : ​​​https://github.com/Erls-Corporation/open-webkit-sharp​​

準備工作

下載下傳open-webkit-sharp

git clone ​​https://github.com/Erls-Corporation/open-webkit-sharp.git​​

項目需求

  • ​​Microsoft C++ 2005 Redistributable​​
  • Windows XP/Vista/7 32/64位系統
  • Apple QuickTime (可選,可優化Html5)

使用Example

  • 把Core檔案夾所有所件拷貝到build目錄裡

    即可啟動OpenWebKitSharp Example項目。

    其它項目不需要使用則可以解除安裝。

在自己項目裡使用WebKitSharp

  • 打開How to use.txt按步驟操作
  • 使用VS建立一個自己的WinForm項目
  • 進入Core檔案夾,選擇所有檔案,拷貝所有檔案,複制到自己項目的build目錄裡(預設 debug或release目錄)
  • 把Reference路徑下所有檔案也複制到自己build目錄裡
  • 自己的項目添加引用:OpenWebKitSharp.dll and WebKit.Interop.dll。

    .Net2.0或3.5,dll位置在Binary_NET2

    .Net4.0,dll位置在Binary

  • 到自己的WinForm程式,在工具箱選擇按右鍵-選擇項
    open-webkit-sharp使用
  • 把工具箱裡的WebKitBrowser拖到自己項目的WinForm裡

    另一種操作方式是打開OpenWebKitSharp.csproj,把輸出路徑指向到自己項目的Build路徑。

private void Form1_Load(object sender, EventArgs e) 
{ 
    this.webKitBrowser1.Navigate("http://url"); 
    this.webKitBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webKitBrowser1_DocumentCompleted); 
} 
void webKitBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) 
{ 
    this.webKitBrowser1.GetScriptManager.ScriptObject = new myClass(); 
}      

繼續閱讀