Пример #1
0
        private ActivityDesigner GetDesignerToResize(Point point, out DesignerEdges sizingEdge)
        {
            ActivityDesigner designerToResize = null;

            sizingEdge = DesignerEdges.None;

            ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService;

            if (selectionService != null)
            {
                ArrayList selectedComponents = new ArrayList(selectionService.GetSelectedComponents());
                for (int i = 0; i < selectedComponents.Count && designerToResize == null; i++)
                {
                    Activity activity = selectedComponents[i] as Activity;
                    if (activity != null)
                    {
                        ActivityDesigner potentialResizableDesigner = ActivityDesigner.GetDesigner(activity);
                        if (potentialResizableDesigner != null)
                        {
                            SelectionGlyph selectionGlyph = potentialResizableDesigner.Glyphs[typeof(SelectionGlyph)] as SelectionGlyph;
                            if (selectionGlyph != null)
                            {
                                foreach (Rectangle grabHandle in selectionGlyph.GetGrabHandles(potentialResizableDesigner))
                                {
                                    if (grabHandle.Contains(point))
                                    {
                                        designerToResize = potentialResizableDesigner;
                                        sizingEdge       = GetSizingEdge(designerToResize, point);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(designerToResize);
        }
Пример #2
0
        private ActivityDesigner GetDesignerToResize(Point point, out DesignerEdges sizingEdge)
        {
            ActivityDesigner designer = null;

            sizingEdge = DesignerEdges.None;
            ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService;

            if (service != null)
            {
                ArrayList list = new ArrayList(service.GetSelectedComponents());
                for (int i = 0; (i < list.Count) && (designer == null); i++)
                {
                    Activity activity = list[i] as Activity;
                    if (activity != null)
                    {
                        ActivityDesigner designer2 = ActivityDesigner.GetDesigner(activity);
                        if (designer2 != null)
                        {
                            SelectionGlyph glyph = designer2.Glyphs[typeof(SelectionGlyph)] as SelectionGlyph;
                            if (glyph != null)
                            {
                                foreach (Rectangle rectangle in glyph.GetGrabHandles(designer2))
                                {
                                    if (rectangle.Contains(point))
                                    {
                                        designer   = designer2;
                                        sizingEdge = this.GetSizingEdge(designer, point);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(designer);
        }