/// <summary> /// Initialize a new instance of the ViewLayoutRibbonScrollPort class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="orientation">Viewport orientation.</param> /// <param name="viewFiller">View to size and position.</param> /// <param name="insetForTabs">Should scoller be inset for use in tabs area.</param> /// <param name="scrollSpeed">Scrolling speed.</param> /// <param name="needPaintDelegate">Delegate for notifying paint/layout requests.</param> public ViewLayoutRibbonScrollPort(KryptonRibbon ribbon, Orientation orientation, ViewBase viewFiller, bool insetForTabs, int scrollSpeed, NeedPaintHandler needPaintDelegate) { Debug.Assert(ribbon != null); Debug.Assert(viewFiller != null); Debug.Assert(needPaintDelegate != null); // Remember initial settings _ribbon = ribbon; _orientation = orientation; _viewFiller = viewFiller; _needPaintDelegate = needPaintDelegate; _scrollSpeed = scrollSpeed; _ribbonTabs = viewFiller as ViewLayoutRibbonTabs; // Default to left hand scroll position _scrollOffset = 0; // Place the child view inside a actual control, so that the contents of the // filler are clipped to the control size. This is needed if the child view // contains controls and need clipping inside this area and so prevent them // from drawing over the end scrollers. _viewControlContent = new RibbonViewControl(ribbon); _viewControlContent.PaintBackground += OnViewControlPaintBackground; ViewLayoutControl = new ViewLayoutControl(_viewControlContent, ribbon, _viewFiller); // For ribbon tabs we want to monitor and intercept the WM_NCHITTEST so that the remainder of the // tabs area acts like the application title bar and can be used to manipulate the application if (_ribbonTabs != null) { ViewLayoutControl.ChildControl.WndProcHitTest += OnChildWndProcHitTest; } // Create the two scrollers used when not enough space for filler _nearScroller = new ViewLayoutRibbonScroller(ribbon, NearOrientation, insetForTabs, needPaintDelegate); _farScroller = new ViewLayoutRibbonScroller(ribbon, FarOrientation, insetForTabs, needPaintDelegate); // Hook into scroller events _nearScroller.Click += OnNearClick; _farScroller.Click += OnFarClick; // Add elements in correct order Add(ViewLayoutControl); Add(_nearScroller); Add(_farScroller); }
/// <summary> /// Initialize a new instance of the ViewLayoutRibbonScrollPort class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="orientation">Viewport orientation.</param> /// <param name="viewFiller">View to size and position.</param> /// <param name="insetForTabs">Should scoller be inset for use in tabs area.</param> /// <param name="scrollSpeed">Scrolling speed.</param> /// <param name="needPaintDelegate">Delegate for notifying paint/layout requests.</param> public ViewLayoutRibbonScrollPort(KryptonRibbon ribbon, Orientation orientation, ViewBase viewFiller, bool insetForTabs, int scrollSpeed, NeedPaintHandler needPaintDelegate) { Debug.Assert(ribbon != null); Debug.Assert(viewFiller != null); Debug.Assert(needPaintDelegate != null); // Remember initial settings _ribbon = ribbon; _orientation = orientation; _viewFiller = viewFiller; _needPaintDelegate = needPaintDelegate; _scrollSpeed = scrollSpeed; _ribbonTabs = viewFiller as ViewLayoutRibbonTabs; // Default to left hand scroll position _scrollOffset = 0; // Place the child view inside a actual control, so that the contents of the // filler are clipped to the control size. This is needed if the child view // contains controls and need clipping inside this area and so prevent them // from drawing over the end scrollers. _viewControlContent = new RibbonViewControl(ribbon); _viewControlContent.PaintBackground += new PaintEventHandler(OnViewControlPaintBackground); _viewControl = new ViewLayoutControl(_viewControlContent, ribbon, _viewFiller); // For ribbon tabs we want to monitor and intercept the WM_NCHITTEST so that the remainder of the // tabs area acts like the application title bar and can be used to manipulate the application if (_ribbonTabs != null) _viewControl.ChildControl.WndProcHitTest += new EventHandler<ViewControlHitTestArgs>(OnChildWndProcHitTest); // Create the two scrollers used when not enough space for filler _nearScroller = new ViewLayoutRibbonScroller(ribbon, NearOrientation, insetForTabs, needPaintDelegate); _farScroller = new ViewLayoutRibbonScroller(ribbon, FarOrientation, insetForTabs, needPaintDelegate); // Hook into scroller events _nearScroller.Click += new EventHandler(OnNearClick); _farScroller.Click += new EventHandler(OnFarClick); // Add elements in correct order Add(_viewControl); Add(_nearScroller); Add(_farScroller); }