We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use the Docking Manager to dock an embedded web browser in a form?

 

The embedded web browser cannot be docked like a regular dockable control. This is because the docking windows layout initialization attempts to access the web browser’s handle while that control is still in the process of being created which could result in a System.Reflection.TargetInvocationException. This happens with other ActiveX wrappers too. The ActiveX control handle sometimes gets created more than once during initialization and this interferes with the re-parenting that takes place when a dock state is being loaded. An easy workaround to this would be set a panel control as the docking window and use this as a place holder, instead of directly enabling docking on the ActiveX control.

Handle the DockingManager's NewDockStateEndLoad event, parent the ActiveX control to the panel, and set its desired DockStyle value.

C#

private void dockingManager1_NewDockStateEndLoad(object sender, System.EventArgs e)

{

object o=null;

// panel1 is the docking window and label1 is the HTML control

this.panel1.Controls.Add (this.label1);

this.label1.Dock = DockStyle.Fill;

this.axWebBrowser1.Navigate("http://www.syncfusion.com",ref o,ref o,ref o,ref o);

}

VB

Private Sub dockingManager1_NewDockStateEndLoad(ByVal sender As Object, ByVal e As System.EventArgs)

' panel1 is the docking window and label1 is the HTML control

Dim o As Object = Nothing

Me.panel1.Controls.Add (Me.label1)

Me.label1.Dock = DockStyle.Fill

Me.AxWebBrowser1.Navigate("http://www.syncfusion.com", o, o, o, o)

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
1053 04/30/2011 07/10/2014 WinForms DockingManager
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon