我想做一個在自助機上操作的程式,怎么實作如圖那樣的切換界面的效果,不一定非要滑動效果,只要是在原界面上打開新界面即可,只要不是彈窗型別的就行
uj5u.com熱心網友回復:
最簡單的就是TabControl了 也可以自己自定義控制元件uj5u.com熱心網友回復:
使用ContentControl+UserControl或者Frame+Page即可。uj5u.com熱心網友回復:
/// <summary>
/// 移動組件
/// </summary>
public void moveTo(FrameworkElement control, Point destinationPoint, double space)
{
Point curPoint = new Point();
if (double.IsNaN(Canvas.GetLeft(control)) || double.IsNaN(Canvas.GetLeft(control)))
{
curPoint = TranslatePoint(new Point(0, 0), control);
curPoint.X = curPoint.X < 0 ? -curPoint.X : curPoint.X;
curPoint.Y = curPoint.Y < 0 ? -curPoint.Y : curPoint.Y;
}
else
{
curPoint.X = Canvas.GetLeft(control);
curPoint.Y = Canvas.GetTop(control);
}
Storyboard storyboard = new Storyboard();
double lxspeed = space, lyspeed = space;
DoubleAnimation doubleAnimation = new DoubleAnimation(
curPoint.X,
destinationPoint.X,
new Duration(TimeSpan.FromMilliseconds(lxspeed * 1000))
);
Storyboard.SetTarget(doubleAnimation, control);
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Left)"));
storyboard.Children.Add(doubleAnimation);
doubleAnimation = new DoubleAnimation(
curPoint.Y,
destinationPoint.Y,
new Duration(TimeSpan.FromMilliseconds(lyspeed * 1000))
);
Storyboard.SetTarget(doubleAnimation, control);
Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)"));
storyboard.Children.Add(doubleAnimation);
storyboard.Begin();
}
uj5u.com熱心網友回復:
接上面下載 http://bbs.cskin.net/thread-15559-1-2.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/86338.html
標籤:C#
