示例#1
0
        internal override void CreateAllStyle() 
        {
            Invariant.Assert(App != null, "RootBrowserWindow must be created in an Application");

            IHostService ihs = (IHostService)App.GetService(typeof(IHostService)); 

            Invariant.Assert(ihs!=null, "IHostService in RootBrowserWindow cannot be null"); 
            Invariant.Assert(ihs.HostWindowHandle != IntPtr.Zero, "IHostService.HostWindowHandle in RootBrowserWindow cannot be null"); 

            //This sets the _ownerHandle correctly and will be used to create the _sourceWindow 
            //with the correct parent
            UIPermission uip = new UIPermission(UIPermissionWindow.AllWindows);
            uip.Assert();//Blessed Assert to set owner handle and to set styles
            try 
            {
                this.OwnerHandle = ihs.HostWindowHandle; 
                this.Win32Style = NativeMethods.WS_CHILD | NativeMethods.WS_CLIPCHILDREN | NativeMethods.WS_CLIPSIBLINGS; 
            }
            finally 
            {
                CodeAccessPermission.RevertAssert();
            }
 
        }