Exemplo n.º 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);
            }
 internal override void Execute(AxHost ctl)
 {
     if (this.dirties)
     {
         ctl.MakeDirty();
     }
     ctl.DoVerb(base.id);
 }