示例#1
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public DrawToolDot(DrawToolDots parent, int id, double x = 0, double y = 0)
 {
     this.Parent = parent;
     this.DotID  = id;
     this.X      = x;
     this.Y      = y;
 }
示例#2
0
        /// <summary>
        /// Добавляет точки в коллекцию. DotID каждой новой точки увеличивается на еденицу
        /// </summary>
        public void AddPoints(DrawToolDots parent, IEnumerable <Point> points)
        {
            int max = this.DefaultIfEmpty(DrawToolDot.Empty).Max(p => p.DotID) + 1;

            foreach (Point p in points)
            {
                base.Add(new DrawToolDot(parent, max, p.X, p.Y));
                max++;
            }
        }
示例#3
0
        /// <summary>
        /// конструктор
        /// </summary>
        public DrawTool(Window Window, Canvas Workspace, Border CanvasBorder, Canvas Canvas, DrawToolType type)
        {
            this.canvas       = Canvas;
            this.window       = Window;
            this.workspace    = Workspace;
            this.canvasBorder = CanvasBorder;
            this.Selection    = new List <Shape>();

            this.border                  = (Border)XamlReader.Parse(DrawTool.BorderControlXaml);
            this.dotsControl             = (ItemsControl)XamlReader.Parse(DrawTool.DotsItemsControlXaml);
            this.dots                    = new DrawToolDots();
            this.dotsControl.Tag         = this.dots;
            this.dotsControl.ItemsSource = this.dots.Dots;
            this.border.Visibility       = Visibility.Hidden;

            this.workspace.Children.Add(this.border);
            this.canvas.Children.Add(this.dotsControl);
            this.SetToolType(type);
        }