示例#1
0
        unsafe HRESULT Ole32.IOleControlSite.TransformCoords(Point *pPtlHimetric, PointF *pPtfContainer, Ole32.XFORMCOORDS dwFlags)
        {
            if (pPtlHimetric == null || pPtfContainer == null)
            {
                return(HRESULT.E_INVALIDARG);
            }

            if ((dwFlags & Ole32.XFORMCOORDS.HIMETRICTOCONTAINER) != 0)
            {
                if ((dwFlags & Ole32.XFORMCOORDS.SIZE) != 0)
                {
                    pPtfContainer->X = (float)WebBrowserHelper.HM2Pix(pPtlHimetric->X, WebBrowserHelper.LogPixelsX);
                    pPtfContainer->Y = (float)WebBrowserHelper.HM2Pix(pPtlHimetric->Y, WebBrowserHelper.LogPixelsY);
                }
                else if ((dwFlags & Ole32.XFORMCOORDS.POSITION) != 0)
                {
                    pPtfContainer->X = (float)WebBrowserHelper.HM2Pix(pPtlHimetric->X, WebBrowserHelper.LogPixelsX);
                    pPtfContainer->Y = (float)WebBrowserHelper.HM2Pix(pPtlHimetric->Y, WebBrowserHelper.LogPixelsY);
                }
                else
                {
                    return(HRESULT.E_INVALIDARG);
                }
            }
            else if ((dwFlags & Ole32.XFORMCOORDS.CONTAINERTOHIMETRIC) != 0)
            {
                if ((dwFlags & Ole32.XFORMCOORDS.SIZE) != 0)
                {
                    pPtlHimetric->X = WebBrowserHelper.Pix2HM((int)pPtfContainer->X, WebBrowserHelper.LogPixelsX);
                    pPtlHimetric->Y = WebBrowserHelper.Pix2HM((int)pPtfContainer->Y, WebBrowserHelper.LogPixelsY);
                }
                else if ((dwFlags & Ole32.XFORMCOORDS.POSITION) != 0)
                {
                    pPtlHimetric->X = WebBrowserHelper.Pix2HM((int)pPtfContainer->X, WebBrowserHelper.LogPixelsX);
                    pPtlHimetric->Y = WebBrowserHelper.Pix2HM((int)pPtfContainer->Y, WebBrowserHelper.LogPixelsY);
                }
                else
                {
                    return(HRESULT.E_INVALIDARG);
                }
            }
            else
            {
                return(HRESULT.E_INVALIDARG);
            }

            return(HRESULT.S_OK);
        }
示例#2
0
        /// <include file='doc\WebBrowserSiteBase.uex' path='docs/doc[@for="WebBrowserSiteBase.UnsafeNativeMethods.IOleControlSite.TransformCoords"]/*' />
        /// <internalonly/>
        int UnsafeNativeMethods.IOleControlSite.TransformCoords(NativeMethods._POINTL pPtlHimetric, NativeMethods.tagPOINTF pPtfContainer, int dwFlags)
        {
            if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_HIMETRICTOCONTAINER) != 0)
            {
                if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_SIZE) != 0)
                {
                    pPtfContainer.x = (float)WebBrowserHelper.HM2Pix(pPtlHimetric.x, WebBrowserHelper.LogPixelsX);
                    pPtfContainer.y = (float)WebBrowserHelper.HM2Pix(pPtlHimetric.y, WebBrowserHelper.LogPixelsY);
                }
                else if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_POSITION) != 0)
                {
                    pPtfContainer.x = (float)WebBrowserHelper.HM2Pix(pPtlHimetric.x, WebBrowserHelper.LogPixelsX);
                    pPtfContainer.y = (float)WebBrowserHelper.HM2Pix(pPtlHimetric.y, WebBrowserHelper.LogPixelsY);
                }
                else
                {
                    return(NativeMethods.E_INVALIDARG);
                }
            }
            else if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_CONTAINERTOHIMETRIC) != 0)
            {
                if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_SIZE) != 0)
                {
                    pPtlHimetric.x = WebBrowserHelper.Pix2HM((int)pPtfContainer.x, WebBrowserHelper.LogPixelsX);
                    pPtlHimetric.y = WebBrowserHelper.Pix2HM((int)pPtfContainer.y, WebBrowserHelper.LogPixelsY);
                }
                else if ((dwFlags & NativeMethods.ActiveX.XFORMCOORDS_POSITION) != 0)
                {
                    pPtlHimetric.x = WebBrowserHelper.Pix2HM((int)pPtfContainer.x, WebBrowserHelper.LogPixelsX);
                    pPtlHimetric.y = WebBrowserHelper.Pix2HM((int)pPtfContainer.y, WebBrowserHelper.LogPixelsY);
                }
                else
                {
                    return(NativeMethods.E_INVALIDARG);
                }
            }
            else
            {
                return(NativeMethods.E_INVALIDARG);
            }

            return(NativeMethods.S_OK);
        }
        int UnsafeNativeMethods.IOleControlSite.TransformCoords(System.Windows.Forms.NativeMethods._POINTL pPtlHimetric, System.Windows.Forms.NativeMethods.tagPOINTF pPtfContainer, int dwFlags)
        {
            if ((dwFlags & 4) != 0)
            {
                if ((dwFlags & 2) == 0)
                {
                    if ((dwFlags & 1) == 0)
                    {
                        return(-2147024809);
                    }
                    pPtfContainer.x = WebBrowserHelper.HM2Pix(pPtlHimetric.x, WebBrowserHelper.LogPixelsX);
                    pPtfContainer.y = WebBrowserHelper.HM2Pix(pPtlHimetric.y, WebBrowserHelper.LogPixelsY);
                }
                else
                {
                    pPtfContainer.x = WebBrowserHelper.HM2Pix(pPtlHimetric.x, WebBrowserHelper.LogPixelsX);
                    pPtfContainer.y = WebBrowserHelper.HM2Pix(pPtlHimetric.y, WebBrowserHelper.LogPixelsY);
                }
            }
            else
            {
                if ((dwFlags & 8) != 0)
                {
                    if ((dwFlags & 2) != 0)
                    {
                        pPtlHimetric.x = WebBrowserHelper.Pix2HM((int)pPtfContainer.x, WebBrowserHelper.LogPixelsX);
                        pPtlHimetric.y = WebBrowserHelper.Pix2HM((int)pPtfContainer.y, WebBrowserHelper.LogPixelsY);
                        goto Label_00F6;
                    }
                    if ((dwFlags & 1) != 0)
                    {
                        pPtlHimetric.x = WebBrowserHelper.Pix2HM((int)pPtfContainer.x, WebBrowserHelper.LogPixelsX);
                        pPtlHimetric.y = WebBrowserHelper.Pix2HM((int)pPtfContainer.y, WebBrowserHelper.LogPixelsY);
                        goto Label_00F6;
                    }
                }
                return(-2147024809);
            }
Label_00F6:
            return(0);
        }