Resource URL:http://www.awesomium.com/download/
備註:使用這核心封裝出來的安裝檔,在Windown 10中的Windows Defender會警示有"Trojan: Win32/Fathale.B!plock"或"Trojan: Win32/Gatrid.E!cl"兩種...XD哩,拿了PCCillin、ESET、AVG跟spyhunter掃描都顯示無異常,結果爬文估狗大師說問題出在awesomium這個OpenSource包的Dll上面,看來它的若干行為跟特洛伊很像吧,被封鎖ㄌ...
備註:使用這核心封裝出來的安裝檔,在Windown 10中的Windows Defender會警示有"Trojan: Win32/Fathale.B!plock"或"Trojan: Win32/Gatrid.E!cl"兩種...XD哩,拿了PCCillin、ESET、AVG跟spyhunter掃描都顯示無異常,結果爬文估狗大師說問題出在awesomium這個OpenSource包的Dll上面,看來它的若干行為跟特洛伊很像吧,被封鎖ㄌ...
Visual Studio 2015 Memo:
- 將下載回來的執行檔安裝。
- 於Visual Studio "選擇工具箱項目"將awsomium開頭的打勾,有Core Windows.Controls Windows.Forms。
- 新增一個Form,然後加入一個TabControl,其餘的背景Code參考如下。
- Sample Code可以參考 Awesomium_in_WF 專案。
Awesomium.Windows.Forms.WebControl myBrowser;
#region TabControl 增加 Browser
private void createNewTab() {
this.SuspendLayout();
var ws = WebCore.CreateWebSession(new WebPreferences() { Javascript = true });
myBrowser = new Awesomium.Windows.Forms.WebControl() { WebSession = ws };
myBrowser.Dock = DockStyle.Fill;
page.Controls.Add(myBrowser);
tabControl1.TabPages.Add(page);
myBrowser.LoadingFrameComplete += new Awesomium.Core.FrameEventHandler(LoadingFrameComplete);
myBrowser.Source = new Uri("https://www.google.com");
myBrowser.Update();
this.ResumeLayout(false);
}
private void LoadingFrameComplete(object sender, Awesomium.Core.FrameEventArgs e) {
if (myBrowser.IsLoading || !myBrowser.IsLive)
return;
this.tabControl1.TabPages[tabControl1.SelectedIndex].Text = " " + myBrowser.Title;
myBrowser.LoadingFrameComplete -= new Awesomium.Core.FrameEventHandler(LoadingFrameComplete);
}
#endregion
#region TabControl 增加 Close Button
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) {
Rectangle r = e.Bounds;
r = tabControl1.GetTabRect(e.Index);
r.Offset(2, 2);
r.Width = 5;
r.Height = 5;
Brush b = new SolidBrush(Color.Black);
Pen p = new Pen(b);
e.Graphics.DrawLine(p, r.X, r.Y, r.X + r.Width, r.Y + r.Height);
e.Graphics.DrawLine(p, r.X + r.Width, r.Y, r.X, r.Y + r.Height);
string titel = this.tabControl1.TabPages[e.Index].Text;
Font f = this.Font;
e.Graphics.DrawString(titel, f, b, new PointF(r.X + 5, r.Y));
}
}
private void tabControl1_MouseClick(object sender, MouseEventArgs e) {
Point p = e.Location;
for (int i = 0; i < this.tabControl1.TabPages.Count; i++) {
Rectangle r = tabControl1.GetTabRect(i);
r.Offset(2, 2);
r.Width = 5;
r.Height = 5;
if (r.Contains(p)) {
CloseTab(i);
}
}
}
private void CloseTab(int i) {
this.tabControl1.TabPages.Remove(this.tabControl1.TabPages[i]);
}
#endregion
#endregion
沒有留言:
張貼留言