예제 #1
0
            unsafe HRESULT IOleInPlaceSite.OnPosRectChange(RECT *lprcPosRect)
            {
                if (lprcPosRect is null)
                {
                    return(HRESULT.E_INVALIDARG);
                }

                // The MediaPlayer control has a AllowChangeDisplaySize property that users
                // can set to control size changes at runtime, but the control itself ignores that and sets the new size.
                // We prevent this by not allowing controls to call OnPosRectChange(), unless we instantiated the resize.
                // visual basic6 does the same.
                //
                bool useRect = true;

                if (AxHost.windowsMediaPlayer_Clsid.Equals(host.clsid))
                {
                    useRect = host.GetAxState(AxHost.handlePosRectChanged);
                }

                if (useRect)
                {
                    Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "in OnPosRectChange" + lprcPosRect->ToString());
                    RECT clipRect = WebBrowserHelper.GetClipRect();
                    host.GetInPlaceObject().SetObjectRects(lprcPosRect, &clipRect);
                    host.MakeDirty();
                }
                else
                {
                    Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "Control directly called OnPosRectChange... ignoring the new size");
                }

                return(HRESULT.S_OK);
            }
예제 #2
0
            unsafe HRESULT IOleInPlaceSite.GetWindowContext(
                out IOleInPlaceFrame ppFrame,
                out IOleInPlaceUIWindow ppDoc,
                RECT *lprcPosRect,
                RECT *lprcClipRect,
                OLEINPLACEFRAMEINFO *lpFrameInfo)
            {
                ppDoc   = null;
                ppFrame = host.GetParentContainer();

                if (lprcPosRect is null || lprcClipRect is null)
                {
                    return(HRESULT.E_POINTER);
                }

                *lprcPosRect  = host.Bounds;
                *lprcClipRect = WebBrowserHelper.GetClipRect();
                if (lpFrameInfo != null)
                {
                    lpFrameInfo->cb            = (uint)Marshal.SizeOf <OLEINPLACEFRAMEINFO>();
                    lpFrameInfo->fMDIApp       = BOOL.FALSE;
                    lpFrameInfo->hAccel        = IntPtr.Zero;
                    lpFrameInfo->cAccelEntries = 0;
                    lpFrameInfo->hwndFrame     = host.ParentInternal.Handle;
                }

                return(HRESULT.S_OK);
            }
예제 #3
0
        unsafe HRESULT UnsafeNativeMethods.IOleInPlaceSite.GetWindowContext(
            out UnsafeNativeMethods.IOleInPlaceFrame ppFrame,
            out UnsafeNativeMethods.IOleInPlaceUIWindow ppDoc,
            RECT *lprcPosRect,
            RECT *lprcClipRect,
            NativeMethods.tagOIFI lpFrameInfo)
        {
            ppDoc   = null;
            ppFrame = Host.GetParentContainer();

            if (lprcPosRect == null || lprcClipRect == null)
            {
                return(HRESULT.E_POINTER);
            }

            *lprcPosRect  = Host.Bounds;
            *lprcClipRect = WebBrowserHelper.GetClipRect();
            if (lpFrameInfo != null)
            {
                lpFrameInfo.cb            = Marshal.SizeOf <NativeMethods.tagOIFI>();
                lpFrameInfo.fMDIApp       = false;
                lpFrameInfo.hAccel        = IntPtr.Zero;
                lpFrameInfo.cAccelEntries = 0;
                lpFrameInfo.hwndFrame     = (Host.ParentInternal == null) ? IntPtr.Zero : Host.ParentInternal.Handle;
            }

            return(HRESULT.S_OK);
        }
예제 #4
0
 private int OnActiveXRectChange(NativeMethods.COMRECT lprcPosRect)
 {
     this.Host.AXInPlaceObject.SetObjectRects(
         NativeMethods.COMRECT.FromXYWH(0, 0, lprcPosRect.right - lprcPosRect.left, lprcPosRect.bottom - lprcPosRect.top),
         WebBrowserHelper.GetClipRect());
     this.Host.MakeDirty();
     return(NativeMethods.S_OK);
 }
예제 #5
0
        private unsafe HRESULT OnActiveXRectChange(RECT *lprcPosRect)
        {
            if (lprcPosRect == null)
            {
                return(HRESULT.E_INVALIDARG);
            }

            var posRect  = new RECT(0, 0, lprcPosRect->right - lprcPosRect->left, lprcPosRect->bottom - lprcPosRect->top);
            var clipRect = WebBrowserHelper.GetClipRect();

            Host.AXInPlaceObject.SetObjectRects(&posRect, &clipRect);
            Host.MakeDirty();
            return(HRESULT.S_OK);
        }
 int UnsafeNativeMethods.IOleInPlaceSite.GetWindowContext(out UnsafeNativeMethods.IOleInPlaceFrame ppFrame, out UnsafeNativeMethods.IOleInPlaceUIWindow ppDoc, System.Windows.Forms.NativeMethods.COMRECT lprcPosRect, System.Windows.Forms.NativeMethods.COMRECT lprcClipRect, System.Windows.Forms.NativeMethods.tagOIFI lpFrameInfo)
 {
     ppDoc              = null;
     ppFrame            = this.Host.GetParentContainer();
     lprcPosRect.left   = this.Host.Bounds.X;
     lprcPosRect.top    = this.Host.Bounds.Y;
     lprcPosRect.right  = this.Host.Bounds.Width + this.Host.Bounds.X;
     lprcPosRect.bottom = this.Host.Bounds.Height + this.Host.Bounds.Y;
     lprcClipRect       = WebBrowserHelper.GetClipRect();
     if (lpFrameInfo != null)
     {
         lpFrameInfo.cb            = Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.tagOIFI));
         lpFrameInfo.fMDIApp       = false;
         lpFrameInfo.hAccel        = IntPtr.Zero;
         lpFrameInfo.cAccelEntries = 0;
         lpFrameInfo.hwndFrame     = (this.Host.ParentInternal == null) ? IntPtr.Zero : this.Host.ParentInternal.Handle;
     }
     return(0);
 }