public WebKitBrowser()
{
InitializeComponent();
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
// Control Events
this.Load += new EventHandler(WebKitBrowser_Load);
this.Resize += new EventHandler(WebKitBrowser_Resize);
// If this is the first time the library has been loaded,
// initialize the activation context required to load the
// WebKit COM component registration free
if ((actCtxRefCount++) == 0)
{
activationContext = new ActivationContext("WebKitBrowser.dll.manifest");
activationContext.Initialize();
// TODO: more error handling here
// Enable OLE for drag and drop functionality - WebKit
// will throw an OutOfMemory exception if we don't...
Application.OleRequired();
}
// If this control is brought to focus, focus our webkit child window
this.GotFocus += (s, e) =>
{
W32API.SetFocus(webViewHWND);
};
activationContext.Activate();
webView = new WebViewClass();
activationContext.Deactivate();
}
}