Beispiel #1
0
        private void UpdateChildBorders(ViewBase child,
                                        ViewLayoutContext context,
                                        ref PaletteDrawBorders leftEdges,
                                        ref PaletteDrawBorders rightEdges,
                                        ref PaletteDrawBorders topEdges,
                                        ref PaletteDrawBorders bottomEdges,
                                        ref PaletteDrawBorders fillEdges)
        {
            // Do we need to calculate if the child should remove any borders?
            if (RemoveChildBorders)
            {
                // Check if the view is a canvas
                ViewDrawCanvas childCanvas = child as ViewDrawCanvas;

                // Docking edge determines calculation
                switch (CalculateDock(GetDock(child), context.Control))
                {
                case ViewDockStyle.Fill:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(fillEdges, childCanvas.Orientation);
                    }
                    else
                    {
                        ViewLayoutDocker layoutDocker = child as ViewLayoutDocker;
                        if (layoutDocker != null)
                        {
                            foreach (ViewBase layoutChild in layoutDocker)
                            {
                                childCanvas = layoutChild as ViewDrawCanvas;
                                if (childCanvas != null)
                                {
                                    childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(fillEdges, childCanvas.Orientation);
                                }
                            }
                        }
                    }
                    break;

                case ViewDockStyle.Top:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(topEdges, childCanvas.Orientation);
                    }

                    // Remove top edges from subsequent children
                    leftEdges  &= PaletteDrawBorders.BottomLeftRight;
                    rightEdges &= PaletteDrawBorders.BottomLeftRight;
                    topEdges   &= PaletteDrawBorders.BottomLeftRight;
                    fillEdges  &= PaletteDrawBorders.BottomLeftRight;
                    break;

                case ViewDockStyle.Bottom:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(bottomEdges, childCanvas.Orientation);
                    }

                    // Remove bottom edges from subsequent children
                    leftEdges   &= PaletteDrawBorders.TopLeftRight;
                    rightEdges  &= PaletteDrawBorders.TopLeftRight;
                    bottomEdges &= PaletteDrawBorders.TopLeftRight;
                    fillEdges   &= PaletteDrawBorders.TopLeftRight;
                    break;

                case ViewDockStyle.Left:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(leftEdges, childCanvas.Orientation);
                    }

                    // Remove left edges from subsequent children
                    topEdges    &= PaletteDrawBorders.TopBottomRight;
                    bottomEdges &= PaletteDrawBorders.TopBottomRight;
                    leftEdges   &= PaletteDrawBorders.TopBottomRight;
                    fillEdges   &= PaletteDrawBorders.TopBottomRight;
                    break;

                case ViewDockStyle.Right:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(rightEdges, childCanvas.Orientation);
                    }

                    // Remove right edges from subsequent children
                    topEdges    &= PaletteDrawBorders.TopBottomLeft;
                    bottomEdges &= PaletteDrawBorders.TopBottomLeft;
                    rightEdges  &= PaletteDrawBorders.TopBottomLeft;
                    fillEdges   &= PaletteDrawBorders.TopBottomLeft;
                    break;
                }
            }
        }