private void CreateView() { // Override the palette provided values _backForced = new PaletteBackInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBack); _borderForced = new PaletteBorderInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBorder); // Create the background and border view _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonColorButton, _backForced, _borderForced, true, _needPaint); _viewMediumSmall.SplitVertical = false; _viewMediumSmall.Click += new EventHandler(OnSmallButtonClick); _viewMediumSmall.DropDown += new EventHandler(OnSmallButtonDropDown); if (_ribbon.InDesignMode) { _viewMediumSmall.ContextClick += new MouseEventHandler(OnContextClick); } // Create the layout docker for the contents of the button ViewLayoutDocker contentLayout = new ViewLayoutDocker(); // Create the image and drop down content _viewMediumSmallImage = new ViewDrawRibbonGroupClusterColorButtonImage(_ribbon, _ribbonColorButton); _viewMediumSmallText1 = new ViewDrawRibbonGroupClusterColorButtonText(_ribbon, _ribbonColorButton); _viewMediumSmallText1.Visible = (_currentSize != GroupItemSize.Small); _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon); _viewMediumSmallText2Sep1 = new ViewLayoutRibbonSeparator(3, false); _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false); ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding); imagePadding.Add(_viewMediumSmallImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(imagePadding); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep1); _viewMediumSmallCenter.Add(_viewMediumSmallDropArrow); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep2); // Use content as only fill item contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Add the content into the background and border _viewMediumSmall.Add(contentLayout); // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); // Provide back reference to the button definition _ribbonColorButton.ClusterColorButtonView = _viewMediumSmall; // Define the actual view Add(_viewMediumSmall); }
private void CreateView() { // Override the palette provided values _backForced = new PaletteBackInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBack); _borderForced = new PaletteBorderInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBorder); // Create the background and border view _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonColorButton, _backForced, _borderForced, true, _needPaint); _viewMediumSmall.SplitVertical = false; _viewMediumSmall.Click += new EventHandler(OnSmallButtonClick); _viewMediumSmall.DropDown += new EventHandler(OnSmallButtonDropDown); if (_ribbon.InDesignMode) _viewMediumSmall.ContextClick += new MouseEventHandler(OnContextClick); // Create the layout docker for the contents of the button ViewLayoutDocker contentLayout = new ViewLayoutDocker(); // Create the image and drop down content _viewMediumSmallImage = new ViewDrawRibbonGroupClusterColorButtonImage(_ribbon, _ribbonColorButton); _viewMediumSmallText1 = new ViewDrawRibbonGroupClusterColorButtonText(_ribbon, _ribbonColorButton); _viewMediumSmallText1.Visible = (_currentSize != GroupItemSize.Small); _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon); _viewMediumSmallText2Sep1 = new ViewLayoutRibbonSeparator(3, false); _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false); ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding); imagePadding.Add(_viewMediumSmallImage); // Layout the content in the center of a row _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter(); _viewMediumSmallCenter.Add(imagePadding); _viewMediumSmallCenter.Add(_viewMediumSmallText1); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep1); _viewMediumSmallCenter.Add(_viewMediumSmallDropArrow); _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep2); // Use content as only fill item contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill); // Add the content into the background and border _viewMediumSmall.Add(contentLayout); // Create controller for intercepting events to determine tool tip handling _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, _viewMediumSmall, _viewMediumSmall.MouseController); // Provide back reference to the button definition _ribbonColorButton.ClusterColorButtonView = _viewMediumSmall; // Define the actual view Add(_viewMediumSmall); }