private SnipPagePart[] GetPartsAtEx(IPartContainer container, Rectangle rect) { List <SnipPagePart> list = new List <SnipPagePart>(); //bool hasHited = false; foreach (SnipPagePart part in container.ChildParts) { if (part.HitTest(rect)) { //hasHited = true; list.Add(part); ///递归检测其下的子Part if (part.HasChild) { SnipPagePart[] arrParts = GetPartsAtEx(part, rect); list.AddRange(arrParts); } } //else if (hasHited) //若是跳出,则可能出现不连续的选择不成功 //{ // break; //} } return(list.ToArray()); }
public void AddExecInsertPartCommand(SnipPagePart part, IPartContainer parent, int index) { InsertPartCommand cmd = new InsertPartCommand(part, parent, index); cmd.Execute(); AddCommand(cmd); Designer.IsModified = true; }
public void AddExecAddPartCommand(IPartContainer parent, SnipPagePart part) { AddPartCommand cmd = new AddPartCommand(parent, part); cmd.Execute(); AddCommand(cmd); Designer.IsModified = true; }
/// <summary> /// 判断subContainer是否是当前Part的孙Part /// </summary> bool IsSub(IPartContainer subContainer) { IPartContainer subContainerParent = subContainer; while (subContainerParent != null && !(subContainerParent is SnipPageDesigner)) { if (subContainerParent == this) { return(true); } subContainerParent = subContainerParent.ParentContainer; } return(false); }
public Point PointToDesigner(Point point) { int x = point.X; int y = point.Y; IPartContainer parentBox = this.ParentContainer; while (parentBox != null && !(parentBox is SnipPageDesigner)) { x += parentBox.Bounds.X; y += parentBox.Bounds.Y; parentBox = parentBox.ParentContainer; } return(new Point(x, y)); }
internal void RemoveCore(SnipPagePart part) { int index = _innerList.IndexOf(part); IPartContainer partContainer = part.ParentContainer; part.ParentContainer = null; bool bl = _innerList.Remove(part); if (bl) { ///维护SnipPagePart的Index for (int i = index; i < _innerList.Count; i++) { _innerList[i].Index = i; } ///重新布局 partContainer.LayoutParts(); } }
public void MoveTo(IPartContainer parentContainer, int index) { ///Index为-1,表示当前Part是新增Part,那么直接放到指定位置并打开编辑窗口 if (this.Index == -1) { parentContainer.ChildParts.Insert(index, this); Designer.EditPart(this, true); } ///同一级,位置一样,则直接返回 else if (ParentContainer == parentContainer && this.Index == index) { return; } ///不能把当前Part移到自己的子Part里去 else if (IsSub(parentContainer)) { return; } ///位置不一样,移动节点 else { ///开始批命令操作 try { ParentContainer.Designer.CmdManager.BeginBatchCommand(); ///移动节点 if (ParentContainer == parentContainer && this.Index < index) { index--; } this.ParentContainer.ChildParts.Remove(this); parentContainer.ChildParts.Insert(index, this); } finally { ///结束批命令操作 ParentContainer.Designer.CmdManager.EndBatchCommand(); } } }
public ClassPartContainer(IPartContainer parentContainer) { ResourcesReader.SetObjectResourcesHelper(this); PartContainer = parentContainer; DisplaySpace = SoftwareOption.SnipDesigner.DisplaySpace; BoxFillColor = SoftwareOption.SnipDesigner.BoxFillColor; TextColor = SoftwareOption.SnipDesigner.TextColor; SelectedPenColor = SoftwareOption.SnipDesigner.SelectedPenColor; ItemPenColor = SoftwareOption.SnipDesigner.ItemPenColor; BoxPenColor = SoftwareOption.SnipDesigner.BoxPenColor; StaticPartColor = SoftwareOption.SnipDesigner.StaticPartColor; NavagationPartColor = SoftwareOption.SnipDesigner.NavagationPartColor; AttributePartColor = SoftwareOption.SnipDesigner.AttributePartColor; PathPartColor = SoftwareOption.SnipDesigner.PathPartColor; PathPartForeColor = SoftwareOption.SnipDesigner.PathPartForeColor; AttributePartForeColor = SoftwareOption.SnipDesigner.AttributePartForeColor; NavagationPartForeColor = SoftwareOption.SnipDesigner.NavagationPartForeColor; StaticPartForeColor = SoftwareOption.SnipDesigner.StaticPartForeColor; BoxForeColor = SoftwareOption.SnipDesigner.BoxForeColor; PieRadii = SoftwareOption.SnipDesigner.PieRadii; //需要添加到选项里 UsingLinearGradient = SoftwareOption.SnipDesigner.UsingLinearGradient; }
public InsertPartCommand(SnipPagePart part, IPartContainer parent, int index) : base(part) { this._parent = parent; this._index = index; }
public AddPartCommand(IPartContainer parent, SnipPagePart part) : base(part) { this._parent = parent; }
public SnipPagePartCollection(IPartContainer parentContainer) { ParentContainer = parentContainer; }
public RemovePartCommand(SnipPagePart part) : base(part) { this._parent = Part.ParentContainer; _position = Parent.ChildParts.IndexOf(Part); }