private void HiMetric2Pixel(NativeMethods.tagSIZEL sz, NativeMethods.tagSIZEL szout)
 {
     NativeMethods._POINTL _pointl = new NativeMethods._POINTL();
     _pointl.x = sz.cx;
     _pointl.y = sz.cy;
     NativeMethods.tagPOINTF pointf = new NativeMethods.tagPOINTF();
     ((UnsafeNativeMethods.IOleControlSite) this.activeXSite).TransformCoords(_pointl, pointf, NativeMethods.tagXFORMCOORDS.XFORMCOORDS_HIMETRICTOCONTAINER | NativeMethods.tagXFORMCOORDS.XFORMCOORDS_SIZE);
     szout.cx = (int)pointf.x;
     szout.cy = (int)pointf.y;
 }
Example #2
0
 void UnsafeNativeMethods.IOleControlSite.TransformCoords(NativeMethods._POINTL pPtlHimetric, NativeMethods.tagPOINTF pPtfContainer, NativeMethods.tagXFORMCOORDS dwFlags)
 {
     if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_HIMETRICTOCONTAINER) != 0)
     {
         if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_SIZE) != 0)
         {
             pPtfContainer.x = ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
             pPtfContainer.y = ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
             return;
         }
         if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_POSITION) != 0)
         {
             pPtfContainer.x = ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
             pPtfContainer.y = ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
             return;
         }
         throw new COMException("IOleControlSite", (int)NativeMethods.HRESULT.E_INVALIDARG);
     }
     if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_CONTAINERTOHIMETRIC) != 0)
     {
         if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_SIZE) != 0)
         {
             pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
             pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
             return;
         }
         if ((dwFlags & NativeMethods.tagXFORMCOORDS.XFORMCOORDS_POSITION) != 0)
         {
             pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
             pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
             return;
         }
     }
     throw new COMException("IOleControlSite", (int)NativeMethods.HRESULT.E_INVALIDARG);
 }