Exemple #1
0
        int UnsafeNativeMethods.IOleControlSite.TransformCoords(NativeMethods.POINT pPtlHimetric, NativeMethods.POINTF pPtfContainer, int dwFlags)
        {
            if ((dwFlags & NativeMethods.XFORMCOORDS_HIMETRICTOCONTAINER) != 0)
            {
                if ((dwFlags & NativeMethods.XFORMCOORDS_SIZE) != 0)
                {
                    pPtfContainer.x = (float)ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
                    pPtfContainer.y = (float)ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
                }
                else if ((dwFlags & NativeMethods.XFORMCOORDS_POSITION) != 0)
                {
                    pPtfContainer.x = (float)ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
                    pPtfContainer.y = (float)ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
                }
                else
                {
                    return(NativeMethods.E_INVALIDARG);
                }
            }
            else if ((dwFlags & NativeMethods.XFORMCOORDS_CONTAINERTOHIMETRIC) != 0)
            {
                if ((dwFlags & NativeMethods.XFORMCOORDS_SIZE) != 0)
                {
                    pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
                    pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
                }
                else if ((dwFlags & NativeMethods.XFORMCOORDS_POSITION) != 0)
                {
                    pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
                    pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
                }
                else
                {
                    return(NativeMethods.E_INVALIDARG);
                }
            }
            else
            {
                return(NativeMethods.E_INVALIDARG);
            }

            return(NativeMethods.S_OK);
        }
 // Token: 0x06007772 RID: 30578 RVA: 0x00221A84 File Offset: 0x0021FC84
 int UnsafeNativeMethods.IOleControlSite.TransformCoords(NativeMethods.POINT pPtlHimetric, NativeMethods.POINTF pPtfContainer, int dwFlags)
 {
     if ((dwFlags & 4) != 0)
     {
         if ((dwFlags & 2) != 0)
         {
             pPtfContainer.x = (float)ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
             pPtfContainer.y = (float)ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
         }
         else
         {
             if ((dwFlags & 1) == 0)
             {
                 return(-2147024809);
             }
             pPtfContainer.x = (float)ActiveXHelper.HM2Pix(pPtlHimetric.x, ActiveXHelper.LogPixelsX);
             pPtfContainer.y = (float)ActiveXHelper.HM2Pix(pPtlHimetric.y, ActiveXHelper.LogPixelsY);
         }
     }
     else
     {
         if ((dwFlags & 8) == 0)
         {
             return(-2147024809);
         }
         if ((dwFlags & 2) != 0)
         {
             pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
             pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
         }
         else
         {
             if ((dwFlags & 1) == 0)
             {
                 return(-2147024809);
             }
             pPtlHimetric.x = ActiveXHelper.Pix2HM((int)pPtfContainer.x, ActiveXHelper.LogPixelsX);
             pPtlHimetric.y = ActiveXHelper.Pix2HM((int)pPtfContainer.y, ActiveXHelper.LogPixelsY);
         }
     }
     return(0);
 }
Exemple #3
0
        internal void TransitionDownTo(ActiveXHelper.ActiveXState state)
        {
            if (!this.GetAxHostState(ActiveXHelper.inTransition)) 
            {
                this.SetAxHostState(ActiveXHelper.inTransition, true); 
 
                try
                { 
                    ActiveXHelper.ActiveXState oldState;

                    while (state < this.ActiveXState)
                    { 
                        oldState = this.ActiveXState;
 
                        switch (this.ActiveXState) 
                        {
                            case ActiveXHelper.ActiveXState.Open: 
                                Debug.Fail("how did we ever get into the open state?");
                                this.ActiveXState = ActiveXHelper.ActiveXState.UIActive;
                                break;
                            case ActiveXHelper.ActiveXState.UIActive: 
                                TransitionFromUIActiveToInPlaceActive();
                                Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.InPlaceActive, "Failed transition"); 
                                this.ActiveXState = ActiveXHelper.ActiveXState.InPlaceActive; 
                                break;
                            case ActiveXHelper.ActiveXState.InPlaceActive: 
                                TransitionFromInPlaceActiveToRunning();
                                Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Running, "Failed transition");
                                this.ActiveXState = ActiveXHelper.ActiveXState.Running;
                                break; 
                            case ActiveXHelper.ActiveXState.Running:
                                TransitionFromRunningToLoaded(); 
                                Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Failed transition"); 
                                this.ActiveXState = ActiveXHelper.ActiveXState.Loaded;
                                break; 
                            case ActiveXHelper.ActiveXState.Loaded:
                                TransitionFromLoadedToPassive();
                                Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Passive, "Failed transition");
                                this.ActiveXState = ActiveXHelper.ActiveXState.Passive; 
                                break;
                            default: 
                                Debug.Fail("bad state"); 
                                this.ActiveXState = this.ActiveXState - 1;  // To exit the loop
                                break; 
                        }

                        OnActiveXStateChange((int)oldState, (int)this.ActiveXState);
                    } 
                }
                finally 
                { 
                    this.SetAxHostState(ActiveXHelper.inTransition, false);
                } 
            }
        }