View element adds padding to the provided drawing area.
Inheritance: ComponentFactory.Krypton.Toolkit.ViewComposite
Exemple #1
0
        private void CreateCollapsedView()
        {
            // Create a layout for the main area
            _layoutCollapsedMain = new ViewLayoutDocker();

            // Add a mouse controller so we know when it has been pressed
            _collapsedController                  = new CollapsedGroupController(_ribbon, _layoutCollapsedMain, _needPaint);
            _collapsedController.Click           += new MouseEventHandler(OnCollapsedClick);
            _layoutCollapsedMain.MouseController  = _collapsedController;
            _layoutCollapsedMain.SourceController = _collapsedController;
            _layoutCollapsedMain.KeyController    = _collapsedController;

            // Reduce layout area to remove the group border
            ViewLayoutRibbonPadding layoutCollapsedInsidePadding = new ViewLayoutRibbonPadding(COLLAPSED_PADDING);

            _layoutCollapsedMain.Add(layoutCollapsedInsidePadding, ViewDockStyle.Fill);

            // Position at top an area that is padded for containing the image
            ViewLayoutDocker layoutCollapsedInside = new ViewLayoutDocker();

            layoutCollapsedInsidePadding.Add(layoutCollapsedInside);

            // Create the layout for the second line of text
            ViewLayoutRibbonRowCenter layoutCollapsedText2 = new ViewLayoutRibbonRowCenter();

            _viewCollapsedText2 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, false);
            layoutCollapsedText2.Add(_viewCollapsedText2);
            layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true));
            layoutCollapsedText2.Add(new ViewDrawRibbonDropArrow(_ribbon));
            layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true));
            layoutCollapsedInside.Add(layoutCollapsedText2, ViewDockStyle.Top);

            // Add the first line of text
            _viewCollapsedText1 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, true);
            layoutCollapsedInside.Add(_viewCollapsedText1, ViewDockStyle.Top);

            // Add group image frame
            _layoutCollapsedImagePadding = new ViewLayoutRibbonCenterPadding(COLLAPSED_IMAGE_PADDING_2007);
            layoutCollapsedInside.Add(_layoutCollapsedImagePadding, ViewDockStyle.Top);

            // Finally we add the actual drawing element for the collapsed group image
            ViewDrawRibbonGroupImage drawCollapsedImage = new ViewDrawRibbonGroupImage(_ribbon, _ribbonGroup, this);

            _layoutCollapsedImagePadding.Add(drawCollapsedImage);
        }
        private void CreateCollapsedView()
        {
            // Create a layout for the main area
            _layoutCollapsedMain = new ViewLayoutDocker();

            // Add a mouse controller so we know when it has been pressed
            _collapsedController = new CollapsedGroupController(_ribbon, _layoutCollapsedMain, _needPaint);
            _collapsedController.Click += new MouseEventHandler(OnCollapsedClick);
            _layoutCollapsedMain.MouseController = _collapsedController;
            _layoutCollapsedMain.SourceController = _collapsedController;
            _layoutCollapsedMain.KeyController = _collapsedController;

            // Reduce layout area to remove the group border
            ViewLayoutRibbonPadding layoutCollapsedInsidePadding = new ViewLayoutRibbonPadding(COLLAPSED_PADDING);
            _layoutCollapsedMain.Add(layoutCollapsedInsidePadding, ViewDockStyle.Fill);

            // Position at top an area that is padded for containing the image
            ViewLayoutDocker layoutCollapsedInside = new ViewLayoutDocker();
            layoutCollapsedInsidePadding.Add(layoutCollapsedInside);

            // Create the layout for the second line of text
            ViewLayoutRibbonRowCenter layoutCollapsedText2 = new ViewLayoutRibbonRowCenter();
            _viewCollapsedText2 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, false);
            layoutCollapsedText2.Add(_viewCollapsedText2);
            layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true));
            layoutCollapsedText2.Add(new ViewDrawRibbonDropArrow(_ribbon));
            layoutCollapsedText2.Add(new ViewLayoutRibbonSeparator(2, 10, true));
            layoutCollapsedInside.Add(layoutCollapsedText2, ViewDockStyle.Top);

            // Add the first line of text
            _viewCollapsedText1 = new ViewDrawRibbonGroupText(_ribbon, _ribbonGroup, true);
            layoutCollapsedInside.Add(_viewCollapsedText1, ViewDockStyle.Top);

            // Add group image frame
            _layoutCollapsedImagePadding = new ViewLayoutRibbonCenterPadding(COLLAPSED_IMAGE_PADDING_2007);
            layoutCollapsedInside.Add(_layoutCollapsedImagePadding, ViewDockStyle.Top);

            // Finally we add the actual drawing element for the collapsed group image
            ViewDrawRibbonGroupImage drawCollapsedImage = new ViewDrawRibbonGroupImage(_ribbon, _ribbonGroup, this);
            _layoutCollapsedImagePadding.Add(drawCollapsedImage);
        }