//淡入淡出 void AssetActionFade(AssetActionInfo assetAction, DesignerItem item, double fromValue, double toValue) { DoubleAnimation doubleAnimation = new DoubleAnimation(fromValue, toValue, new Duration(GetSpan(assetAction.Time))); doubleAnimation.FillBehavior = FillBehavior.HoldEnd; doubleAnimation.Completed += (sender, e) => { item.BeginAnimation(DesignerItem.OpacityProperty, null); }; item.BeginAnimation(DesignerItem.OpacityProperty, doubleAnimation, HandoffBehavior.SnapshotAndReplace); }
//左侧飞入 void AssetActionMove(AssetActionInfo assetAction, DesignerItem item, double fromValue, double toValue) { DoubleAnimation doubleAnimation = new DoubleAnimation(fromValue, toValue, new Duration(GetSpan(assetAction.Time))); doubleAnimation.FillBehavior = FillBehavior.HoldEnd; doubleAnimation.Completed += (sender, e) => { item.BeginAnimation(Canvas.LeftProperty, null); }; item.BeginAnimation(Canvas.LeftProperty, doubleAnimation); }
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { double[] oldValue; this.DesignerItem = DataContext as DesignerItem; if (this.DesignerItem != null) { this.DesignerCanvas = VisualTreeHelper.GetParent(this.DesignerItem) as DesignerCanvas; if (this.DesignerCanvas != null) { oldValueList.Clear(); foreach (DesignerItem item in this.DesignerCanvas.SelectedItems) { item.canvas = this.DesignerCanvas; Point p = new Point(); //p = item.TranslatePoint( //new Point(0,0), // this.DesignerCanvas); // item.centerPoint = item.TranslatePoint( //new Point(item.ActualWidth/2, // item.ActualHeight/ 2), // this.DesignerCanvas); Point startPoint = Mouse.GetPosition(this.DesignerCanvas); item.StartVector = Point.Subtract(startPoint, item.centerPoint); item.RotateTransform = item.RenderTransform as RotateTransform; if (item.RotateTransform == null) { item.RenderTransform = new RotateTransform(0); item.InitialAngle = 0; } else { item.InitialAngle = item.RotateTransform.Angle; } oldValue = new double[5] { item.GetHashCode(), item.ActualWidth, item.ActualHeight, Canvas.GetLeft(item), Canvas.GetTop(item) }; oldValueList.Add(oldValue); } } } }
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { double[] oldValue; this.DesignerItem = DataContext as DesignerItem; if (this.DesignerItem != null) { this.DesignerCanvas = VisualTreeHelper.GetParent(this.DesignerItem) as DesignerCanvas; oldValueList.Clear(); foreach (DesignerItem item in this.DesignerCanvas.SelectedItems) { oldValue = new double[5] { item.GetHashCode(), item.ActualWidth, item.ActualHeight, Canvas.GetLeft(item), Canvas.GetTop(item) }; oldValueList.Add(oldValue); } } }
public PropertyFontBoldCommand(DesignerItem item) { _item = item; }
public PropertyRotateCommand(DesignerItem item) { _item = item; }
public ControlRemove(DesignerItem contentControl) { _contentcontrol = contentControl; _contentCanvas = _contentcontrol.Parent as DesignerCanvas; }
public ControlMoveOrResize(DesignerItem item) { _item = item; }
public PropertySkewYCommand(DesignerItem item) { _item = item; }
public PropertyTranslateYCommand(DesignerItem item) { _item = item; }
public PropertyScaleXCommand(DesignerItem item) { _item = item; }
public ControlCreate(DesignerItem item) { _item = item; _contentCanvas = _item.Parent as DesignerCanvas; }
public PropertyFontSizeCommand(DesignerItem item) { _item = item; }
public PropertyOpacityCommand(DesignerItem item) { _item = item; }
public PropertyWidthCommand(DesignerItem item) { _item = item; }
public PropertyHeightCommand(DesignerItem item) { _item = item; }
public PropertyFontItalicCommand(DesignerItem item) { _item = item; }