Advertisement
Guest User

anim

a guest
Sep 19th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Forms;
  5. using System.Windows.Media.Animation;
  6. using System.Windows.Threading;
  7.  
  8. namespace Robolahing
  9. {
  10.     /// <summary>
  11.     /// Interaction logic for DisplayWindow.xaml
  12.     /// </summary>
  13.     public partial class DisplayWindow : Window
  14.     {
  15.         public DisplayWindow()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Window_Loaded(object sender, RoutedEventArgs e)
  21.         {
  22.             Screen s = Screen.AllScreens[1];
  23.  
  24.             System.Drawing.Rectangle r = s.WorkingArea;
  25.             this.Top = r.Top;
  26.             this.Left = r.Left + (r.Width / 2);
  27.             this.WindowState = WindowState.Maximized;
  28.  
  29.             CoverLeft.Height = GraphicsCanvas.ActualHeight;
  30.  
  31.             Canvas.SetLeft(CoverRight,GraphicsCanvas.ActualWidth/2);
  32.             CoverRight.Height = GraphicsCanvas.ActualHeight;
  33.  
  34.         }
  35.  
  36.         private void Window_Closed(object sender, System.EventArgs e)
  37.         {
  38.             if (App.Current.MainWindow != null)
  39.             {
  40.                 App.Current.MainWindow.Close();
  41.             }
  42.         }
  43.  
  44.         public void animateCover()
  45.         {
  46.             DoubleAnimation myDoubleAnimation = new DoubleAnimation();
  47.             myDoubleAnimation.From = 0;
  48.             myDoubleAnimation.To = 2*GraphicsCanvas.ActualHeight;
  49.             myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000));
  50.  
  51.             Storyboard.SetTargetName(myDoubleAnimation, CoverRight.Name);
  52.             Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(WHAT_ON_EARTH?));
  53.  
  54.             // Create a storyboard to contain the animation.
  55.             Storyboard myWidthAnimatedButtonStoryboard = new Storyboard();
  56.             myWidthAnimatedButtonStoryboard.Begin(CoverRight);
  57.  
  58.         }
  59.  
  60.        
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement