public static void Y2_PC(DependencyObject obj, DependencyPropertyChangedEventArgs e) { lineControl c = obj as lineControl; double nv = (double)e.NewValue; c.Y2 = c.line.Y2 = nv; c.ChangeAnimationValue(); }
private void Canvas_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Line = new lineControl() { X1 = (Line == null) ? Mouse.GetPosition(this).X - canvas.Margin.Left : Line.X2, Y1 = (Line == null) ? Mouse.GetPosition(this).Y - canvas.Margin.Top : Line.Y2, X2 = Mouse.GetPosition(this).X - canvas.Margin.Left, Y2 = Mouse.GetPosition(this).Y - canvas.Margin.Top }; Line.line.StrokeThickness = 2; //шырина линии _lines.Add(Line); canvas.Children.Add(Line); }
private void Canvas_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { SetLinePosition(Mode); Line = null; }