Beispiel #1
0
 private void Placer_LayoutUpdated(object sender, EventArgs e)
 {
     if (_state == ElementState.Open)
     {
         Point left  = OutAnchorL.TransformToVisual(Layout).Transform(new Point());
         Point right = OutAnchorR.TransformToVisual(Layout).Transform(new Point());
         for (int i = 0; i < Placer.Children.Count; i++)
         {
             UIElement ue = Placer.Children[i];
             if (ue is IElement)
             {
                 IElement element = ue as IElement;
                 Point    lp      = element.LeftAnchor.TransformToVisual(Layout).Transform(new Point());
                 Point    rp      = element.RightAnchor.TransformToVisual(Layout).Transform(new Point());
                 LinkLine lline   = Lines.Children[i * 2] as LinkLine;
                 LinkLine rline   = Lines.Children[i * 2 + 1] as LinkLine;
                 lline.SetPosition(left.X + OutAnchorL.Width, left.Y, lp.X + (element.LeftAnchor as Rectangle).Width, lp.Y, left.X + OutAnchorL.Width + 10);
                 rline.SetPosition(rp.X, rp.Y, right.X, right.Y, right.X - 10);
             }
         }
     }
 }
Beispiel #2
0
        private void Container_LayoutUpdated(object sender, EventArgs e)
        {
            for (int i = 0; i < Placer.Children.Count; i++)
            {
                UIElement ue = Placer.Children[i];
                if (ue is IElement)
                {
                    IElement element = ue as IElement;
                    Point    lp      = element.LeftAnchor.TransformToVisual(Layout).Transform(new Point());
                    Point    rp      = element.RightAnchor.TransformToVisual(Layout).Transform(new Point());
                    LinkLine lline   = Lines.Children[i] as LinkLine;
                    LinkLine rline   = Lines.Children[i + 1] as LinkLine;
                    lline.SetEnd(lp.X + (element.LeftAnchor as Rectangle).Width, lp.Y);
                    rline.SetStart(rp.X, rp.Y);
                }
            }
            Point    la    = AnchorL.TransformToVisual(Layout).Transform(new Point());
            Point    ra    = AnchorR.TransformToVisual(Layout).Transform(new Point());
            LinkLine left  = Lines.Children[0] as LinkLine;
            LinkLine right = Lines.Children[Lines.Children.Count - 1] as LinkLine;

            left.SetStart(la.X, la.Y);
            right.SetEnd(ra.X, ra.Y);
        }