当前位置: 首页>>代码示例>>C#>>正文


C# ScatterViewItem.BeginAnimation方法代码示例

本文整理汇总了C#中ScatterViewItem.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# ScatterViewItem.BeginAnimation方法的具体用法?C# ScatterViewItem.BeginAnimation怎么用?C# ScatterViewItem.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScatterViewItem的用法示例。


在下文中一共展示了ScatterViewItem.BeginAnimation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScatterView_Drop

        private void ScatterView_Drop(object sender, Microsoft.Surface.Presentation.SurfaceDragDropEventArgs e)
        {
            //Darstellen des Dokuments das in den Viewer(ScatterView) gedropped wird.
            //Leeren des Viewers
            viewer.Items.Clear();
            //Bestimmen des Pfades des darzustellenden Dokuments aus e.Cursor.Data
            FileInfo file = new FileInfo(System.IO.Path.Combine((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName));
            //Erstellt ein ScatterViewItem als Träger für das Dokument
            ScatterViewItem newItemSVI = new ScatterViewItem();
            //Überprüfen ob es sich um ein als png gerendertes pdf handelt, oder ein rtf
            if (file.Extension.Equals(".rtf"))
            {
                //Erstellen und füllen einer RichTextBox im ScatterViewItem falls rtf
                var newItem = new RichTextBox();
                newItem.Background = Brushes.Transparent;
                FileStream fs = new FileStream(System.IO.Path.Combine((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName), FileMode.Open, FileAccess.Read);
                TextRange RTBText = new TextRange(newItem.Document.ContentStart, newItem.Document.ContentEnd);
                RTBText.Load(fs, DataFormats.Rtf);
                newItem.IsHitTestVisible = false;
                newItemSVI.Content = newItem;
                newItemSVI.Background = Brushes.White;
                //newItemSVI.BeginAnimation(ScatterViewItem.HeightProperty, animY);

            }
            else
            {
                //Konvertierung des Datei-strings in ein Bild im ScatterViewItem falls png (bzw. nicht rtf)
                Image image = new Image();
                //image.Source = (new ImageSourceConverter().ConvertFromString(file.FullName)) as ImageSource;

            var bitmap = new BitmapImage();
            bitmap.BeginInit();
            bitmap.UriSource = new Uri(file.FullName);
            bitmap.CacheOption = BitmapCacheOption.OnLoad;
            bitmap.EndInit();
            image.Source = bitmap;

                newItemSVI.Content = image;
                newItemSVI.Background = Brushes.Transparent;
            }

            newItemSVI.Width = 491;
            newItemSVI.Height = 700;

            //ImageBrush imgBrush = new ImageBrush();
            //imgBrush.ImageSource = (new ImageSourceConverter().ConvertFromString("Images\\noun_project_450.png")) as ImageSource;
            //newItemSVI.Background = imgBrush;

            //Erzeugen und einblenden des ScatterViewItems das das Dokument beinhaltet, zuweisen des TouchVerhaltens
            newItemSVI.IsHitTestVisible = true;
            newItemSVI.Orientation = 0;
            newItemSVI.CanScale = false;
            newItemSVI.CanRotate = false;
            newItemSVI.CanMove = false;
            DropShadowEffect effect = new DropShadowEffect();
            effect.BlurRadius = 20;
            newItemSVI.Effect = effect;
            //newItemSVI.Center = e.Cursor.GetPosition(viewer);
            newItemSVI.Center = new Point(490, 390);
            viewer.Items.Add(newItemSVI);
            //DoubleAnimation animRot = new DoubleAnimation(0, 0, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            DoubleAnimation animX = new DoubleAnimation(156, 491, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            DoubleAnimation animY = new DoubleAnimation(200, 700, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            PointAnimation animCenter = new PointAnimation(e.Cursor.GetPosition(viewer), new Point(490, 390), new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            //DoubleAnimation animCenterY = new DoubleAnimation(e.Cursor.GetPosition(viewer).Y, 350, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            //newItemSVI.BeginAnimation(ScatterViewItem.OrientationProperty, animRot);
            newItemSVI.BeginAnimation(ScatterViewItem.WidthProperty, animX);
            newItemSVI.BeginAnimation(ScatterViewItem.HeightProperty, animY);
            newItemSVI.BeginAnimation(ScatterViewItem.CenterProperty, animCenter);
            infoItems.Remove((e.Cursor.Data as InfoItem));
            infoItems.Add(new InfoItem((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName, (e.Cursor.Data as InfoItem).GroupName));
            //MessageBox.Show((e.Cursor.Data as InfoItem).FolderPath+"\\"+(e.Cursor.Data as InfoItem).fileName);
            //GenerateItems();
            newItemSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(newItemSVI_PreviewTouchUp);
            newItemSVI.PreviewTouchDown += new EventHandler<TouchEventArgs>(newItemSVI_PreviewTouchDown);
        }
开发者ID:pittruff,项目名称:myStik,代码行数:76,代码来源:Infos.xaml.cs

示例2: timer_Tick

        void timer_Tick(object sender, EventArgs e)
        {
            this.ParentJanitor.ScreenSaverRuns = true;
            this.Dispatcher.Invoke(
            System.Windows.Threading.DispatcherPriority.Normal,
            (DummyDelegate)
            delegate
            {
            ScatterViewItem svi = new ScatterViewItem();
            //Viewbox svi = new Viewbox();
            Viewbox vb = new Viewbox();
            Label label = new Label();

            label.Content = d[rand.Next(0, d.Count)];
            label.Foreground = new SolidColorBrush(Colors.White);
            label.Width = 200;
            label.Height = 50;
            label.FontSize = 20;
            label.FontWeight = FontWeights.ExtraLight;

            label.HorizontalContentAlignment = HorizontalAlignment.Center;
            vb.Child = label;
            svi.Content = vb;
            vb.IsEnabled = false;
            svi.Orientation = 0;
            svi.Opacity = 0;
            svi.Width = 4000;
            svi.Height = 1000;

            BlurEffect blur = new BlurEffect();
            blur.Radius = 50;
            blur.RenderingBias = RenderingBias.Performance;
            blur.KernelType = KernelType.Gaussian;
            svi.Effect = blur;

            svi.ApplyTemplate();
            svi.Background = new SolidColorBrush(Colors.Transparent);
            svi.ShowsActivationEffects = false;
            Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
            ssc = svi.Template.FindName("shadow", svi) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
            ssc.Visibility = Visibility.Hidden;
            svi.BorderBrush = Brushes.Transparent;
            svi.IsHitTestVisible = false;
            svi.ClipToBounds = false;

            DoubleAnimation blurAnim = new DoubleAnimation(20, 10, new Duration(TimeSpan.FromSeconds(4)), FillBehavior.Stop);
            blurAnim.AutoReverse = true;

            blur.BeginAnimation(BlurEffect.RadiusProperty, blurAnim, HandoffBehavior.Compose);

            DoubleAnimation WidthAnim = new DoubleAnimation(200, 4000, new Duration(TimeSpan.FromSeconds(8)), FillBehavior.Stop);
            WidthAnim.Completed += new EventHandler(WidthAnim_Completed);

            svi.BeginAnimation(ScatterViewItem.WidthProperty, WidthAnim, HandoffBehavior.Compose);

            DoubleAnimation HeightAnim = new DoubleAnimation(50, 1000, new Duration(TimeSpan.FromSeconds(8)), FillBehavior.Stop);

            svi.BeginAnimation(ScatterViewItem.HeightProperty, HeightAnim, HandoffBehavior.Compose);

            DoubleAnimation OpacityAnim = new DoubleAnimation(0, .5, new Duration(TimeSpan.FromSeconds(4)), FillBehavior.Stop);
            OpacityAnim.AutoReverse = true;

            svi.BeginAnimation(ScatterViewItem.OpacityProperty, OpacityAnim, HandoffBehavior.Compose);

            //sb.Children.Add(blurAnim);
            //sb.Children.Add(WidthAnim);
            //sb.Children.Add(HeightAnim);
            //sb.Children.Add(OpacityAnim);
            //Storyboard.SetTarget(blurAnim, blur);
            //Storyboard.SetTarget(WidthAnim, svi);
            //Storyboard.SetTarget(HeightAnim, svi);
            //Storyboard.SetTarget(OpacityAnim, svi);
            //Storyboard.SetTargetProperty(blurAnim, new PropertyPath(BlurEffect.RadiusProperty));
            //Storyboard.SetTargetProperty(WidthAnim, new PropertyPath(ScatterViewItem.WidthProperty));
            //Storyboard.SetTargetProperty(HeightAnim, new PropertyPath(ScatterViewItem.HeightProperty));
            //Storyboard.SetTargetProperty(OpacityAnim, new PropertyPath(ScatterViewItem.OpacityProperty));
            //sb.Begin();
            MainSV.Items.Add(svi);

            });
        }
开发者ID:pittruff,项目名称:myStik,代码行数:81,代码来源:Screensaver.xaml.cs


注:本文中的ScatterViewItem.BeginAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。