public RubberbandAdorner(DiagramControl diagramControl, DesignerCanvas designerCanvas, Point?dragStartPoint) : base(designerCanvas) { this.designerCanvas = designerCanvas; this.startPoint = dragStartPoint; rubberbandPen = new Pen(Brushes.LightSlateGray, 1); rubberbandPen.DashStyle = new DashStyle(new double[] { 2 }, 1); DiagramControl = diagramControl; }
public DesignerItem(string id, string text, DiagramControl diagramControl) { this.ItemId = id; Text = text; ItemParentId = string.Empty; Loaded += DesignerItem_Loaded; //Data = new CustomItemData(id); //Data.DiagramControl = diagramControl; DiagramControl = diagramControl; Focusable = false; MouseDoubleClick += (sender, e) => { diagramControl.DiagramManager.Edit(this); }; }
protected override void OnDrop(DragEventArgs e) { base.OnDrop(e); DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject; if (dragObject != null && !String.IsNullOrEmpty(dragObject.Xaml)) { DesignerItem newItem = null; Object content = XamlReader.Load(XmlReader.Create(new StringReader(dragObject.Xaml))); if (content != null) { DiagramControl diagramControl = TemplatedParent as DiagramControl; newItem = new DesignerItem(diagramControl); newItem.Content = content; Point position = e.GetPosition(this); if (dragObject.DesiredSize.HasValue) { Size desiredSize = dragObject.DesiredSize.Value; newItem.Width = desiredSize.Width; newItem.Height = desiredSize.Height; DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X - newItem.Width / 2)); DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y - newItem.Height / 2)); } else { DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X)); DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y)); } Canvas.SetZIndex(newItem, this.Children.Count); this.Children.Add(newItem); SetConnectorDecoratorTemplate(newItem); //update selection this.SelectionService.SelectItem(newItem); newItem.Focus(); } e.Handled = true; } }
public SelectionService(DesignerCanvas canvas, DiagramControl diagramControl) { this.designerCanvas = canvas; this._diagramControl = diagramControl; }
public DesignerItem(string id, string parentItemId, string text, object itemData, DiagramControl diagramControl) : this(id, text, itemData, diagramControl) { ItemParentId = parentItemId; Data = itemData; //itemData.DiagramControl = diagramControl; }
public DesignerItem(string id, string text, object itemData, DiagramControl diagramControl) : this(id, text, diagramControl) { Data = itemData; //itemData.DiagramControl = diagramControl; }
public DesignerItem(DiagramControl diagramControl) : this(Guid.NewGuid().ToString(), "New Item", diagramControl) { }
List<ItemDataBase> _clipbrd = new List<ItemDataBase>(); //clipboard 复制,剪切板 #endregion Fields #region Constructors public DiagramManager(DiagramControl diagramControl) { _diagramControl = diagramControl; }
public DiagramManager(DiagramControl diagramControl) { _diagramControl = diagramControl; }