Пример #1
0
        public EAnimationControl GetAnimateOnEnter(object extendee)
        {
            EAnimationControl eVal = EAnimationControl.None;

            if (extendee is Control)
            {
                if (m_tableValeursOnEnter.TryGetValue((Control)extendee, out eVal))
                {
                    return(eVal);
                }
            }
            return(EAnimationControl.None);
        }
Пример #2
0
        /////////////////////////////////////////
        public void OnMouseDownControl(object control, MouseEventArgs args)
        {
            if (!(control is Control) || ((Control)control).Parent == null)
            {
                return;
            }
            EAnimationControl animation = GetAnimateOnMouseDown(control);

            if (animation != EAnimationControl.None)
            {
                ((Control)control).BeginInvoke(new StartAnimateDelegate(StartAnimate), (Control)control, animation);
            }
        }
Пример #3
0
        /////////////////////////////////////////
        public void SetAnimateOnMouseDown(object extendee, EAnimationControl eAnimate)
        {
            if (!(extendee is Control))
            {
                return;
            }

            if (eAnimate != EAnimationControl.None)
            {
                m_tableValeursOnMouseDown[(Control)extendee] = eAnimate;
                ((Control)extendee).MouseDown += OnMouseDownEventHandler;
            }
            else
            {
                if (m_tableValeursOnMouseDown.ContainsKey((Control)extendee))
                {
                    m_tableValeursOnMouseDown.Remove((Control)extendee);
                }
            }
        }
Пример #4
0
        /////////////////////////////////////////
        private void StartAnimate(Control control, EAnimationControl animation)
        {
            //Sauve le fond
            Bitmap bmpFond = CScreenCopieur.GetDesktopImage();
            //Copie l'image du contrôle
            Bitmap bmpControle = CScreenCopieur.GetWindowImage((Control)control);

            IntPtr   deskDC = GetDC(IntPtr.Zero);
            Graphics g      = Graphics.FromHdc(deskDC);

            Point     pt      = ((Control)control).Parent.PointToScreen(((Control)control).Location);
            Size      sz      = ((Control)control).Size;
            Rectangle maxRect = new Rectangle(0, 0, 0, 0);

            int nNbZoom = animation == EAnimationControl.Zoom ? 1 : 2;

            for (int nZoom = 0; nZoom < nNbZoom; nZoom++)
            {
                double fPas   = 6;
                double fSize  = 0;
                double fRatio = (double)sz.Height / (double)sz.Width;
                while (true)
                {
                    fSize += fPas;
                    if (fPas > 0)
                    {
                        fPas /= 1.1;
                        if (fPas < 0.1)
                        {
                            fPas = 0.1;
                        }
                    }
                    else
                    {
                        fPas *= 1.1;
                    }
                    double    fNewWidth    = (double)sz.Width + fSize;
                    double    fNewHeight   = (double)sz.Height + fSize * fRatio;
                    double    fEcartWidth  = (fNewWidth - sz.Width) / 2.0;
                    double    fEcartHeight = (fNewHeight - sz.Height) / 2.0;
                    Rectangle rct          = new Rectangle((int)(pt.X - fEcartWidth),
                                                           (int)(pt.Y - fEcartHeight),
                                                           (int)(sz.Width + fEcartWidth * 2),
                                                           (int)(sz.Height + fEcartHeight * 2));
                    g.DrawImage(bmpControle, rct);
                    if (rct.Width > maxRect.Width ||
                        rct.Height > maxRect.Height)
                    {
                        maxRect = rct;
                    }
                    if (fSize >= 25)
                    {
                        fPas = -fPas;
                    }
                    if (fSize < 1)
                    {
                        break;
                    }
                    System.Threading.Thread.Sleep(2);
                    //maxRect.Inflate(4, 4);
                    g.DrawImage(bmpFond, maxRect, maxRect, GraphicsUnit.Pixel);
                }
                System.Threading.Thread.Sleep(2);
            }
            //Redessine le fond
            g.DrawImage(bmpFond, maxRect, maxRect, GraphicsUnit.Pixel);
            g.Dispose();
            bmpControle.Dispose();
            bmpFond.Dispose();
        }