當前位置: 首頁>>代碼示例>>C#>>正文


C# Transition.Run方法代碼示例

本文整理匯總了C#中Transitions.Transition.Run方法的典型用法代碼示例。如果您正苦於以下問題:C# Transition.Run方法的具體用法?C# Transition.Run怎麽用?C# Transition.Run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Transitions.Transition的用法示例。


在下文中一共展示了Transition.Run方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: transitionPictures

        /// <summary>
        /// Performs a random tarnsition between the two pictures.
        /// </summary>
        public void transitionPictures()
        {
            // We randomly choose where the current image is going to
            // slide off to (and where we are going to slide the inactive
            // image in from)...
            int iDestinationLeft = (m_Random.Next(2) == 0) ? Width : -Width;
            int iDestinationTop = (m_Random.Next(3) - 1) * Height;

            // We move the inactive image to this location...
            SuspendLayout();
            m_InactivePicture.Top = iDestinationTop;
            m_InactivePicture.Left = iDestinationLeft;
            m_InactivePicture.BringToFront();
            ResumeLayout();

            // We perform the transition which moves the active image off the
            // screen, and the inactive one onto the screen...
            Transition t = new Transition(new EaseInEaseOut(1000));
            t.Add(m_InactivePicture, "Left", 0);
            t.Add(m_InactivePicture, "Top", 0);
            t.Add(m_ActivePicture, "Left", iDestinationLeft);
            t.Add(m_ActivePicture, "Top", iDestinationTop);
            t.Run();

            // We swap over which image is active and inactive for next time
            // the function is called...
            PictureBox tmp = m_ActivePicture;
            m_ActivePicture = m_InactivePicture;
            m_InactivePicture = tmp;
        }
開發者ID:nikeee,項目名稱:net-transitions,代碼行數:33,代碼來源:KittenPuppyControl.cs

示例2: cmdTextTransition_Click

        /// <summary>
        /// Called when the "Text Transition" button is pressed.
        /// </summary>
        private void cmdTextTransition_Click(object sender, EventArgs e)
        {
            // We transition four properties simulataneously here:
            // - The two labels' text is changed.
            // - The two labels' colors are changed.

            // We work out the new text and colors to transition to...
            string strText1, strText2;
            Color color1, color2;
            if (lblTextTransition1.Text == STRING_SHORT)
            {
                strText1 = STRING_LONG;
                color1 = Color.Red;
                strText2 = STRING_SHORT;
                color2 = Color.Blue;
            }
            else
            {
                strText1 = STRING_SHORT;
                color1 = Color.Blue;
                strText2 = STRING_LONG;
                color2 = Color.Red;
            }

            // We create a transition to animate all four properties at the same time...
            Transition t = new Transition(new Linear(1000));
            t.Add(lblTextTransition1, "Text", strText1);
            t.Add(lblTextTransition1, "ForeColor", color1);
            t.Add(lblTextTransition2, "Text", strText2);
            t.Add(lblTextTransition2, "ForeColor", color2);
            t.Run();
        }
開發者ID:nikeee,項目名稱:net-transitions,代碼行數:35,代碼來源:Form1.cs

示例3: cmdSwap_Click

        /// <summary>
        /// Called when the "Swap" button is pressed.
        /// </summary>
        private void cmdSwap_Click(object sender, EventArgs e)
        {
            // We swap over the group-boxes that show the "Bounce" and
            // "Throw and Catch" transitions. The active one is animated
            // left off the screen and the inactive one is animated right
            // onto the screen...

            // We work out which box is currently on screen and
            // which is off screen...
            Control ctrlOnScreen, ctrlOffScreen;
            if (gbBounce.Left == GROUP_BOX_LEFT)
            {
                ctrlOnScreen = gbBounce;
                ctrlOffScreen = gbThrowAndCatch;
            }
            else
            {
                ctrlOnScreen = gbThrowAndCatch;
                ctrlOffScreen = gbBounce;
            }
            ctrlOnScreen.SendToBack();
            ctrlOffScreen.BringToFront();

            // We create a transition to animate the two boxes simultaneously. One is
            // animated onto the screen, the other off the screen.

            // The ease-in-ease-out transition acclerates the rate of change for the
            // first half of the animation, and decelerates during the second half.

            Transition t = new Transition(new EaseInEaseOut(1000));
            t.Add(ctrlOnScreen, "Left", -1 * ctrlOnScreen.Width);
            t.Add(ctrlOffScreen, "Left", GROUP_BOX_LEFT);
            t.Run();
        }
開發者ID:nikeee,項目名稱:net-transitions,代碼行數:37,代碼來源:Form1.cs

示例4: Run

 /// <summary>
 /// Creates and immediately runs a transition on the property passed in.
 /// </summary>
 public static void Run(object target, string strPropertyName, object destinationValue, ITransitionType transitionMethod)
 {
     var t = new Transition(transitionMethod);
     t.Add(target, strPropertyName, destinationValue);
     t.Run();
 }
開發者ID:nikeee,項目名稱:net-transitions,代碼行數:9,代碼來源:Transition.cs


注:本文中的Transitions.Transition.Run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。