public void Dot(Math.Dot2 dot) { Path path; path = new Path(); path.Stroke = Brushes.Black; path.Fill = Brushes.Black; path.StrokeThickness = 1; path.Data = new EllipseGeometry(dot.toPoint(), 3, 3); graph.Children.Add(path); }
void ellipse_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { Math.Operate operate = border.fetchLog(); //oldDownPoint.X = e.GetPosition(graph).X; //oldDownPoint.Y = e.GetPosition(graph).Y; oldDownPoint = new Math.Dot2(ellipse.Margin.Left + ellipse.Width / 2.0, ellipse.Margin.Top + ellipse.Width / 2.0); border.Modify(oldDownPoint, operate.index); if (richText.AllowDraw) { richText.appendTitle("MineGame操作日志:ellipse_MouseLeave"); richText.appendObject(oldDownPoint); } }
public void Ring(Math.Dot2 dot) { Path path; GeometryGroup group = new GeometryGroup(); path = new Path(); path.Fill = Brushes.Brown; path.StrokeThickness = 1; group.Children.Add(new EllipseGeometry(dot.toPoint(), 5, 5)); group.Children.Add(new EllipseGeometry(dot.toPoint(), 3, 3)); path.Data = group; graph.Children.Add(path); }
void ellipse_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { Ellipse ellipse = sender as Ellipse; ellipse.RenderTransform = new ScaleTransform(6, 6); oldDownPoint.X = e.GetPosition(graph).X; oldDownPoint.Y = e.GetPosition(graph).Y; //Lines(border); if (richText.AllowDraw) { richText.appendTitle("MineGame操作日志:ellipse_MouseLeftButtonDown"); richText.appendObject(oldDownPoint); } oldDownPoint -= new Math.Dot2(ellipse.Margin.Left + ellipse.Width / 2.0, ellipse.Margin.Top + ellipse.Width / 2.0); }
public void Reflesh(Math.Dot2 dot) { Math.Operate operate = border.fetchLog(); switch (operate.type) { case Product2.Test.Math.Type.Append: //border.Modify(dot, operate.index); break; case Product2.Test.Math.Type.Insert: //border.Modify(dot, operate.index); break; case Product2.Test.Math.Type.Delete: case Product2.Test.Math.Type.Read: return; case Product2.Test.Math.Type.Modify: //border.Modify(dot, operate.index); break; default: break; } //graph.Children.Clear(); //Lines(border); int index = 0; foreach (UIElement item in graph.Children) { if (item.GetType() == typeof(Line)) { Line line = (Line)item; index++; if (index == operate.index) { line.X2 = dot.X; line.Y2 = dot.Y; } else if (index == operate.index + 1) { line.X1 = dot.X; line.Y1 = dot.Y; } } } }
public void ellipse_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed) { //Ellipse ellipse = sender as Ellipse; if (ellipse == null) { return; } Math.Dot2 dot = new Math.Dot2(e.GetPosition(graph)) - oldDownPoint; Reflesh(dot); ellipse.Margin = new Thickness(e.GetPosition(graph).X - 7 - oldDownPoint.X, e.GetPosition(graph).Y - 7 - oldDownPoint.Y, 0, 0); if (richText.AllowDraw) { richText.appendLine("MineGame操作日志:ellipse_MouseMove"); //richText.appendObject(dot); } } }
public void Appear(Math.Operate operate) { Math.Dot2 dot = operate.dot; switch (operate.type) { case Product2.Test.Math.Type.Append: break; case Product2.Test.Math.Type.Insert: break; case Product2.Test.Math.Type.Delete: case Product2.Test.Math.Type.Read: return; case Product2.Test.Math.Type.Modify: break; default: break; } ellipse = new Ellipse(); ellipse.Width = 14; ellipse.Height = 14; ellipse.Fill = new SolidColorBrush(Colors.Red); ellipse.Stroke = new SolidColorBrush(Colors.Black); ellipse.Margin = new Thickness(dot.X - 7, dot.Y - 7, 0, 0); graph.Children.Add(ellipse); //设置到中心进行旋转 ellipse.RenderTransformOrigin = new Point(0.5, 0.5); ellipse.RenderTransform = new ScaleTransform(1, 1); NameScope.SetNameScope(graph, new NameScope()); graph.RegisterName("mypath", ellipse); Storyboard myStoryboard = new Storyboard(); DoubleAnimation myDoubleAnimation = new DoubleAnimation(); myDoubleAnimation.From = 1; myDoubleAnimation.To = 2; myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5)); Storyboard.SetTargetName(myDoubleAnimation, "mypath"); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath("RenderTransform.ScaleY")); myStoryboard.Children.Add(myDoubleAnimation); //myDoubleAnimation = new DoubleAnimation(); //myDoubleAnimation.From = 1; //myDoubleAnimation.To = 3; //myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1)); //Storyboard.SetTargetName(myDoubleAnimation, "mypath"); //Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath("RenderTransform.ScaleY")); //myStoryboard.Children.Add(myDoubleAnimation); myDoubleAnimation = new DoubleAnimation(); myDoubleAnimation.From = 0.4; myDoubleAnimation.To = 0.8; myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1)); Storyboard.SetTargetName(myDoubleAnimation, "mypath"); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Ellipse.OpacityProperty)); myStoryboard.Children.Add(myDoubleAnimation); ColorAnimation animation = new ColorAnimation(); animation.From = Colors.Orange; animation.To = Colors.Gray; animation.Duration = new Duration(TimeSpan.FromSeconds(1)); Storyboard.SetTargetName(animation, "mypath"); Storyboard.SetTargetProperty(animation, new PropertyPath("Fill.Color")); myStoryboard.Children.Add(animation); ////纵坐标动画 DoubleAnimationUsingKeyFrames ks1e1 = new DoubleAnimationUsingKeyFrames(); this.KeyAddFrame(ks1e1, 0.0, 1, null); this.KeyAddFrame(ks1e1, 0.5, 2.3, new BackEase() { EasingMode = EasingMode.EaseOut, Amplitude = 1.5 }); //this.StoryAddKey(sb, ks1e1, path, new PropertyPath("(0)", this.propertyChain)); Storyboard.SetTargetName(ks1e1, "mypath"); Storyboard.SetTargetProperty(ks1e1, new PropertyPath("RenderTransform.ScaleX")); myStoryboard.Children.Add(ks1e1); ////横坐标动画 //DoubleAnimationUsingKeyFrames ks2e1 = new DoubleAnimationUsingKeyFrames(); //this.KeyAddFrame(ks2e1, 0.0, 50.0, null); //this.KeyAddFrame(ks2e1, 2.0, 350.0, null); //this.StoryAddKey(sb, ks2e1, path, new PropertyPath("(1)", this.propertyChain)); //sb.Begin(); myStoryboard.Begin(ellipse); ellipse.MouseDown += ellipse_MouseDown; ellipse.MouseLeftButtonDown += ellipse_MouseLeftButtonDown; ellipse.MouseLeftButtonUp += ellipse_MouseLeftButtonUp; ellipse.MouseMove += ellipse_MouseMove; ellipse.MouseLeave += ellipse_MouseLeave; if (richText.AllowDraw) { richText.appendTitle("MineGame操作日志"); richText.appendObject(operate); } }