Пример #1
0
        protected virtual void UpdateControlButtonsStyle()
        {
            RadRibbonForm form = this.FindForm() as RadRibbonForm;

            if (form != null && form.RibbonBar != null && form.RibbonBar.RibbonBarElement == this.owner)
            {
                this.backstageElement.TitleBarElement.SystemButtons.Visibility = form.ControlBox ? ElementVisibility.Visible : ElementVisibility.Hidden;
                this.backstageElement.TitleBarElement.IconPrimitive.Visibility = !form.ShowIcon || !form.ControlBox ? ElementVisibility.Collapsed : ElementVisibility.Visible;
                if (form.ControlBox)
                {
                    this.backstageElement.TitleBarElement.MaximizeButton.Enabled    = form.MaximizeBox;
                    this.backstageElement.TitleBarElement.MaximizeButton.Visibility = form.MinimizeBox || form.MaximizeBox ? ElementVisibility.Visible : ElementVisibility.Hidden;
                    this.backstageElement.TitleBarElement.MinimizeButton.Enabled    = form.MinimizeBox;
                    this.backstageElement.TitleBarElement.MinimizeButton.Visibility = form.MaximizeBox || form.MinimizeBox ? ElementVisibility.Visible : ElementVisibility.Hidden;
                    this.backstageElement.TitleBarElement.IconPrimitive.Visibility  = form.ShowIcon ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                }
            }
            if (this.owner == null)
            {
                return;
            }
            if (this.owner.RibbonCaption.CloseButton.Visibility != ElementVisibility.Visible)
            {
                this.backstageElement.TitleBarElement.CloseButton.Visibility = this.owner.RibbonCaption.CloseButton.Visibility;
            }
            if (this.owner.RibbonCaption.MaximizeButton.Visibility != ElementVisibility.Visible)
            {
                this.backstageElement.TitleBarElement.MaximizeButton.Visibility = this.owner.RibbonCaption.MaximizeButton.Visibility;
            }
            if (this.owner.RibbonCaption.MinimizeButton.Visibility == ElementVisibility.Visible)
            {
                return;
            }
            this.backstageElement.TitleBarElement.MinimizeButton.Visibility = this.owner.RibbonCaption.MinimizeButton.Visibility;
        }
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(System.Windows.Forms.Control previewSurface)
        {
            RadRibbonForm radRibbonFormPreview = new RadRibbonForm();

            radRibbonFormPreview.Size = new Size(320, 240);
            RadRibbonBar ribbonbar = new RadRibbonBar();

            ribbonbar.Dock    = System.Windows.Forms.DockStyle.Top;
            ribbonbar.Enabled = false;
            radRibbonFormPreview.Controls.Add(ribbonbar);

            radRibbonFormPreview.Text = "RadRibbonForm";

            radRibbonFormPreview.Anchor =
                System.Windows.Forms.AnchorStyles.Bottom
                | System.Windows.Forms.AnchorStyles.Left
                | System.Windows.Forms.AnchorStyles.Right
                | System.Windows.Forms.AnchorStyles.Top;
            radRibbonFormPreview.AllowAero = false;

            RadRibbonForm radRibbonFormStructure = new RadRibbonForm();

            radRibbonFormStructure.AutoSize = true;

            radRibbonFormStructure.Text = "RadRibbonForm";
            radRibbonFormStructure.Size = new Size(320, 240);

            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(radRibbonFormPreview, radRibbonFormStructure.RootElement);

            designed.MainElementClassName = radRibbonFormStructure.FormElement.GetThemeEffectiveType().FullName;

            res.Add(designed);

            return(res);
        }