packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.cs
/// <summary>
/// Creates and initializes the native ExplorerBrowser control
/// </summary>
Creates and initializes the native ExplorerBrowser control
Creates and initializes the native ExplorerBrowser control
protected override void OnCreateControl()
        {
            base.OnCreateControl();
            if (this.DesignMode == false)
            {
                explorerBrowserControl = new ExplorerBrowserClass();
                ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, this);
                explorerBrowserControl.Advise(
                    Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)),
                    out eventsCookie);
                viewEvents = new ExplorerBrowserViewEvents(this);
                NativeRect rect = new NativeRect();
                rect.Top = ClientRectangle.Top;
                rect.Left = ClientRectangle.Left;
                rect.Right = ClientRectangle.Right;
                rect.Bottom = ClientRectangle.Bottom;
                explorerBrowserControl.Initialize(this.Handle, ref rect, null);
                explorerBrowserControl.SetOptions(ExplorerBrowserOptions.ShowFrames);
                explorerBrowserControl.SetPropertyBag(propertyBagName);
                if (antecreationNavigationTarget != null)
                {
                    BeginInvoke(new MethodInvoker(
                    delegate
                    {
                        Navigate(antecreationNavigationTarget);
                        antecreationNavigationTarget = null;
                    }));
                }
            }
            Application.AddMessageFilter(this);
        }
protected override void OnCreateControl ( ) { base . OnCreateControl ( ) ; if ( this . DesignMode == false ) { explorerBrowserControl = new ExplorerBrowserClass ( ) ; ExplorerBrowserNativeMethods . IUnknown_SetSite ( explorerBrowserControl , this ) ; explorerBrowserControl . Advise ( Marshal . GetComInterfaceForObject ( this , typeof ( IExplorerBrowserEvents ) ) , out eventsCookie ) ; viewEvents = new ExplorerBrowserViewEvents ( this ) ; NativeRect rect = new NativeRect ( ) ; rect . Top = ClientRectangle . Top ; rect . Left = ClientRectangle . Left ; rect . Right = ClientRectangle . Right ; rect . Bottom = ClientRectangle . Bottom ; explorerBrowserControl . Initialize ( this . Handle , ref rect , null ) ; explorerBrowserControl . SetOptions ( ExplorerBrowserOptions . ShowFrames ) ; explorerBrowserControl . SetPropertyBag ( propertyBagName ) ; if ( antecreationNavigationTarget != null ) { BeginInvoke ( new MethodInvoker ( delegate { Navigate ( antecreationNavigationTarget ) ; antecreationNavigationTarget = null ; } ) ) ; } } Application . AddMessageFilter ( this ) ; }
Creates and initializes the native ExplorerBrowser control
Creates and initializes the native ExplorerBrowser control
// hooks up IExplorerPaneVisibility and ICommDlgBrowser event notifications // hooks up IExplorerBrowserEvents event notification // sets up ExplorerBrowser view connection point events // Force an initial show frames so that IExplorerPaneVisibility works the first time it is set. // This also enables the control panel to be browsed to. If it is not set, then navigating to  // the control panel succeeds, but no items are visible in the view.