コード例 #1
0
ファイル: FreeFormPanel.cs プロジェクト: send2vinnie/1709
        static public List <Point> GetEdgeRelativeToOutmostPanel(ConnectionPoint connectionPoint)
        {
            FreeFormPanel parentPanel = StateContainerEditor.GetVisualAncestor <FreeFormPanel>(connectionPoint.ParentDesigner);
            List <Point>  edge        = new List <Point>();

            foreach (Point point in connectionPoint.Edge)
            {
                edge.Add(parentPanel.GetLocationRelativeToOutmostPanel(point));
            }
            return(edge);
        }
コード例 #2
0
ファイル: FreeFormPanel.cs プロジェクト: send2vinnie/1709
        private void MeasureChildren(out double height, out double width)
        {
            height = 0;
            width  = 0;
            Point pt             = new Point(0, 0);
            bool  isOutmostPanel = this.IsOutmostPanel();

            foreach (UIElement child in Children)
            {
                Connector connectorChild = child as Connector;
                if (connectorChild != null && isOutmostPanel)
                {
                    pt = new Point(0, 0);

                    if (measureConnectors)
                    {
                        Point srcPoint  = FreeFormPanel.GetLocationRelativeToOutmostPanel(FreeFormPanel.GetSourceConnectionPoint(connectorChild));
                        Point destPoint = FreeFormPanel.GetLocationRelativeToOutmostPanel(FreeFormPanel.GetDestinationConnectionPoint(connectorChild));
                        if (connectorChild.Points.Count == 0 ||
                            (DesignerGeometryHelper.DistanceBetweenPoints(connectorChild.Points[0], srcPoint) > 1) ||
                            (DesignerGeometryHelper.DistanceBetweenPoints(connectorChild.Points[connectorChild.Points.Count - 1], destPoint) > 1))
                        {
                            connectorChild.Points = new PointCollection();
                            RoutePolyLine(connectorChild);
                        }
                        connectorChild.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                    }
                    else
                    {
                        continue;
                    }
                }
                else //Measure non-connector elements.
                {
                    child.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                    if (!child.DesiredSize.Equals(((Size)FreeFormPanel.GetChildSize(child))))
                    {
                        FreeFormPanel.SetChildSize(child, child.DesiredSize);
                    }
                    pt = FreeFormPanel.GetLocation(child);
                    if (pt.X == 0 && pt.Y == 0)
                    {
                        pt = new Point(LeftStackingMargin, lastYPosition);
                        OnLocationChanged(child, new LocationChangedEventArgs(pt));
                        FreeFormPanel.SetLocation(child, pt);
                        lastYPosition += child.DesiredSize.Height + VerticalStackingDistance;
                    }
                }
                if (height < child.DesiredSize.Height + pt.Y)
                {
                    height = child.DesiredSize.Height + pt.Y;
                }
                if (width < child.DesiredSize.Width + pt.X)
                {
                    width = child.DesiredSize.Width + pt.X;
                }
            }

            width  = (width < this.MinWidth) ? this.MinWidth : width;
            height = (height < this.MinHeight) ? this.MinHeight : height;
        }
コード例 #3
0
ファイル: FreeFormPanel.cs プロジェクト: send2vinnie/1709
        static public Point GetLocationRelativeToOutmostPanel(ConnectionPoint connectionPoint)
        {
            FreeFormPanel parentPanel = StateContainerEditor.GetVisualAncestor <FreeFormPanel>(connectionPoint.ParentDesigner);

            return(parentPanel.GetLocationRelativeToOutmostPanel(connectionPoint.Location));
        }