本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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();
}