ComponentFactory.Krypton.Toolkit.ViewLayoutScrollViewport.ViewLayoutScrollViewport C# (CSharp) Method

ViewLayoutScrollViewport() public method

Initialize a new instance of the ViewLayoutScrollViewport class.
public ViewLayoutScrollViewport ( VisualControl rootControl, ViewBase viewportFiller, PaletteBorderEdge paletteBorderEdge, IPaletteMetric paletteMetrics, PaletteMetricPadding metricPadding, PaletteMetricInt metricOvers, VisualOrientation orientation, RelativePositionAlign alignment, bool animateChange, bool vertical, NeedPaintHandler needPaintDelegate ) : System
rootControl VisualControl Top level visual control.
viewportFiller ViewBase View element to place inside viewport.
paletteBorderEdge PaletteBorderEdge Palette for use with the border edge.
paletteMetrics IPaletteMetric Palette source for metrics.
metricPadding PaletteMetricPadding Metric used to get view padding.
metricOvers PaletteMetricInt Metric used to get overposition.
orientation VisualOrientation Orientation for the viewport children.
alignment RelativePositionAlign Alignment of the children within the viewport.
animateChange bool Animate changes in the viewport.
vertical bool Is the viewport vertical.
needPaintDelegate NeedPaintHandler Delegate for notifying paint requests.
return System
        public ViewLayoutScrollViewport(VisualControl rootControl,
                                        ViewBase viewportFiller,
                                        PaletteBorderEdge paletteBorderEdge,
                                        IPaletteMetric paletteMetrics,
                                        PaletteMetricPadding metricPadding,
                                        PaletteMetricInt metricOvers,
                                        VisualOrientation orientation,
                                        RelativePositionAlign alignment,
                                        bool animateChange,
                                        bool vertical,
                                        NeedPaintHandler needPaintDelegate)
        {
            Debug.Assert(rootControl != null);
            Debug.Assert(viewportFiller != null);
            Debug.Assert(needPaintDelegate != null);

            // We need a way to notify changes in layout
            _needPaintDelegate = needPaintDelegate;

            // By default we are showing the contained viewport in vertical scrolling
            _viewportVertical = vertical;

            // Our initial visual orientation should match the parameter
            Orientation = orientation;

            // Create the child viewport
            _viewport = new ViewLayoutViewport(paletteMetrics, metricPadding,
                                               metricOvers, ViewportOrientation(_viewportVertical),
                                               alignment, animateChange);

            // Default to same alignment for both directions
            _viewport.CounterAlignment = alignment;

            // We always want the viewport to fill any remainder space
            _viewport.FillSpace = true;

            // Put the provided element inside the viewport
            _viewport.Add(viewportFiller);

            // Hook into animation step events
            _viewport.AnimateStep += new EventHandler(OnAnimateStep);

            // To prevent the contents of the viewport from being able to draw outside
            // the viewport (such as having child controls) we use a ViewLayoutControl
            // that uses a child control to restrict the drawing region.
            _viewControl = new ViewLayoutControl(rootControl, _viewport);
            _viewControl.InDesignMode = rootControl.InDesignMode;

            // Create the scrollbar and matching border edge
            _scrollbarV = new ViewDrawScrollBar(true);
            _scrollbarH = new ViewDrawScrollBar(false);
            _borderEdgeV = new ViewDrawBorderEdge(paletteBorderEdge, System.Windows.Forms.Orientation.Vertical);
            _borderEdgeH = new ViewDrawBorderEdge(paletteBorderEdge, System.Windows.Forms.Orientation.Horizontal);

            // Hook into scroll position changes
            _scrollbarV.ScrollChanged += new EventHandler(OnScrollVChanged);
            _scrollbarH.ScrollChanged += new EventHandler(OnScrollHChanged);

            // Add with appropriate docking style
            Add(_viewControl, ViewDockStyle.Fill);
            Add(_borderEdgeV, ViewDockStyle.Right);
            Add(_borderEdgeH, ViewDockStyle.Bottom);
            Add(_scrollbarV, ViewDockStyle.Right);
            Add(_scrollbarH, ViewDockStyle.Bottom);
        }