Esempio n. 1
0
        private void AppCommandTheme_Executed(object sender, EventArgs e)
        {
            ICommandSource source = sender as ICommandSource;

            if (source.CommandParameter is string)
            {
                eStyle style = (eStyle)Enum.Parse(typeof(eStyle), source.CommandParameter.ToString());
                // Using StyleManager change the style and color tinting
                if (StyleManager.IsMetro(style))
                {
                    // More customization is needed for Metro
                    // Capitalize App Button and tab
                    buttonFile.Text = buttonFile.Text.ToUpper();
                    foreach (BaseItem item in RibbonControl.Items)
                    {
                        // Ribbon Control may contain items other than tabs so that needs to be taken in account
                        RibbonTabItem tab = item as RibbonTabItem;
                        if (tab != null)
                        {
                            tab.Text = tab.Text.ToUpper();
                        }
                    }

                    buttonFile.BackstageTabEnabled = true; // Use Backstage for Metro

                    ribbonControl1.RibbonStripFont = new System.Drawing.Font("Segoe UI", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    if (style == eStyle.Metro)
                    {
                        StyleManager.MetroColorGeneratorParameters = DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters.DarkBlue;
                    }

                    // Adjust size of switch button to match Metro styling
                    switchButtonItem1.SwitchWidth  = 16;
                    switchButtonItem1.ButtonWidth  = 48;
                    switchButtonItem1.ButtonHeight = 19;

                    // Adjust tab strip style
                    tabStrip1.Style = eTabStripStyle.Metro;

                    StyleManager.Style = style; // BOOM
                }
                else
                {
                    // If previous style was Metro we need to update other properties as well
                    if (StyleManager.IsMetro(StyleManager.Style))
                    {
                        ribbonControl1.RibbonStripFont = null;
                        // Fix capitalization App Button and tab
                        //buttonFile.Text = ToTitleCase(buttonFile.Text);
                        foreach (BaseItem item in RibbonControl.Items)
                        {
                            // Ribbon Control may contain items other than tabs so that needs to be taken in account
                            RibbonTabItem tab = item as RibbonTabItem;
                            //if (tab != null)
                            //    tab.Text = ToTitleCase(tab.Text);
                        }
                        // Adjust size of switch button to match Office styling
                        switchButtonItem1.SwitchWidth  = 28;
                        switchButtonItem1.ButtonWidth  = 62;
                        switchButtonItem1.ButtonHeight = 20;
                    }
                    // Adjust tab strip style
                    tabStrip1.Style = eTabStripStyle.Office2007Document;
                    StyleManager.ChangeStyle(style, Color.Empty);
                    if (style == eStyle.Office2007Black || style == eStyle.Office2007Blue || style == eStyle.Office2007Silver || style == eStyle.Office2007VistaGlass)
                    {
                        buttonFile.BackstageTabEnabled = false;
                    }
                    else
                    {
                        buttonFile.BackstageTabEnabled = true;
                    }
                }
            }
            else if (source.CommandParameter is Color)
            {
                if (StyleManager.IsMetro(StyleManager.Style))
                {
                    StyleManager.MetroColorGeneratorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(Color.White, (Color)source.CommandParameter);
                }
                else
                {
                    StyleManager.ColorTint = (Color)source.CommandParameter;
                }
            }
        }
 public static bool GetIsTabFromPage(RibbonTabItem item)
 => (bool)item.GetValue(IsTabFromPageProperty);
        private static RibbonGroupBox GetRibbonGroup(string name, string tabName, string groupName, RibbonTabItem ribbonTab, MainWindow window)
        {
            using (new ProfileSection("Get ribbon group"))
            {
                ProfileSection.Argument("name", name);
                ProfileSection.Argument("tabName", tabName);
                ProfileSection.Argument("groupName", groupName);
                ProfileSection.Argument("ribbonTab", ribbonTab);
                ProfileSection.Argument("window", window);

                var ribbonGroup = window.FindName(groupName) as RibbonGroupBox;

                if (ribbonGroup == null)
                {
                    var ribbonTabItem = window.FindName(tabName) as RibbonTabItem;

                    if (ribbonTabItem != null)
                    {
                        var ribbonGroupBoxs = ribbonTabItem.Groups;
                        foreach (
                            var ribbonGroupBox in ribbonGroupBoxs.Where(ribbonGroupBox => ribbonGroupBox.Header.ToString() == name))
                        {
                            ribbonGroup = ribbonGroupBox;
                            break;
                        }
                    }

                    if (ribbonGroup == null)
                    {
                        ribbonGroup = CreateGroup(ribbonTab, name);
                    }
                }

                return(ribbonGroup);
            }
        }
        private static void InitializeRibbonGroup(string name, string tabName, XmlElement groupElement, RibbonTabItem ribbonTab, MainWindow window, Func <string, ImageSource> getImage)
        {
            using (new ProfileSection("Initialize ribbon group"))
            {
                ProfileSection.Argument("name", name);
                ProfileSection.Argument("tabName", tabName);
                ProfileSection.Argument("groupElement", groupElement);
                ProfileSection.Argument("ribbonTab", ribbonTab);
                ProfileSection.Argument("window", window);
                ProfileSection.Argument("getImage", getImage);

                // Get Ribbon Group to insert button to
                name = groupElement.GetNonEmptyAttribute("name");
                var groupName   = tabName + name + "Group";
                var ribbonGroup = GetRibbonGroup(name, tabName, groupName, ribbonTab, window);

                Assert.IsNotNull(ribbonGroup, "Cannot find RibbonGroup with {0} name".FormatWith(groupName));

                var buttons = SelectNonEmptyCollection(groupElement, "button");
                foreach (var button in buttons)
                {
                    InitializeRibbonButton(window, getImage, button, ribbonGroup);
                }
            }
        }
Esempio n. 5
0
        protected void RenderTabs(object parameter, bool isContextual, Action <RibbonTabItem> addTab, Func <ToolbarElement, bool> canRender, Func <object> getContext)
        {
            var elements = AppHost.Container.Get <ToolbarManager>().GetElements(parameter);

            if (FilterElements != null)
            {
                elements = elements.Where(e => FilterElements(e)).ToList();
            }

            string strip = null;
            string chunk = null;

            RibbonTabItem  tab           = null;
            RibbonGroupBox group         = null;
            var            buttonType    = RibbonElementType.LargeButton;
            StackPanel     stackPanel    = null;
            var            smallButtons  = 0;
            var            isTabSelected = !isContextual;

            foreach (var element in elements.OrderBy(c => c.SortOrder).ThenBy(c => c.Strip).ThenBy(c => c.Chunk).ThenBy(c => c.Text))
            {
                if (!canRender(element))
                {
                    continue;
                }

                if (element.Strip != strip)
                {
                    strip = element.Strip;

                    tab = new RibbonTabItem
                    {
                        Header     = strip,
                        IsSelected = isTabSelected
                    };

                    addTab(tab);

                    isTabSelected = false;
                    chunk         = null;
                    group         = null;
                    stackPanel    = null;
                    buttonType    = RibbonElementType.LargeButton;
                }

                if (element.Chunk != chunk)
                {
                    chunk = element.Chunk;

                    group = new RibbonGroupBox
                    {
                        Header = chunk
                    };

                    tab.Groups.Add(group);
                    stackPanel = null;
                    buttonType = RibbonElementType.LargeButton;
                }

                var newButtonType = element.ElementType;
                if (newButtonType == RibbonElementType.CheckBox || newButtonType == RibbonElementType.SmallDropDown || newButtonType == RibbonElementType.SmallToggleButton)
                {
                    newButtonType = RibbonElementType.SmallButton;
                }

                if (newButtonType != buttonType)
                {
                    buttonType = newButtonType;
                    stackPanel = null;

                    if (buttonType == RibbonElementType.SmallButton)
                    {
                        stackPanel = new StackPanel
                        {
                            Margin = new Thickness(4, 0, 4, 0)
                        };

                        group.Items.Add(stackPanel);
                        smallButtons = 0;
                    }
                }

                UIElement control = null;
                switch (element.ElementType)
                {
                case RibbonElementType.LargeButton:
                case RibbonElementType.SmallButton:
                    control = CreateButton(parameter, element, isContextual, getContext);
                    break;

                case RibbonElementType.SmallToggleButton:
                case RibbonElementType.LargeToggleButton:
                    control = CreateToggleButton(parameter, element, isContextual, getContext);
                    break;

                case RibbonElementType.LargeDropDown:
                case RibbonElementType.SmallDropDown:
                    control = CreateDropDown(parameter, element, isContextual, getContext);
                    break;

                case RibbonElementType.Gallery:
                    control = CreateGallery(parameter, element);
                    break;

                case RibbonElementType.CheckBox:
                    control = CreateCheckbox(parameter, element, isContextual, getContext);
                    break;
                }

                if (control == null)
                {
                    continue;
                }

                if (stackPanel != null)
                {
                    if (smallButtons == 3)
                    {
                        stackPanel = new StackPanel();

                        group.Items.Add(stackPanel);
                        smallButtons = 0;
                    }

                    smallButtons++;
                    stackPanel.Children.Add(control);
                }
                else
                {
                    group.Items.Add(control);
                }
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public RibbonTabItemAutomationPeer([NotNull] RibbonTabItem owner)
     : base(owner)
 {
     this.OwningTab = owner;
 }
        /// <summary>
        /// 加载左侧功能栏项
        /// </summary>
        public void LoadSildeBar(string moduleId)
        {
            var currentid = moduleId;

            DataRow[] drows = ClientCache.Instance.DTUserMoule.Select(PiModuleTable.FieldParentId + " = '" + currentid + "'", PiModuleTable.FieldSortCode);
            if (drows.Length <= 0)
            {
                return;
            }
            bool isSelected = false;

            foreach (DataRow dr in drows)
            {
                //只加载模块类型为1(WinForm类型)或3(WinForm与WebForm相结合)的
                var moduleType = BusinessLogic.ConvertToNullableInt(dr[PiModuleTable.FieldModuleType]);

                if (moduleType != null && moduleType != 1 && moduleType != 3)
                {
                    continue;
                }
                //RibbonTabItem>RibbonPanel>RibbonBar>ButtonItem
                RibbonTabItem ribbonTabItem = new RibbonTabItem {
                    Text = dr[PiModuleTable.FieldFullName].ToString().Trim()
                };
                RibbonPanel ribbonPanel = new RibbonPanel {
                    Text = dr[PiModuleTable.FieldFullName].ToString().Trim()
                };

                if (SystemInfo.MultiLanguage)
                {
                    if (SystemInfo.CurrentLanguage.Equals("zh-TW", StringComparison.OrdinalIgnoreCase))
                    {
                        ribbonTabItem.Text = ChineseStringHelper.StringConvert(ribbonTabItem.Text, 1);
                        ribbonPanel.Text   = ChineseStringHelper.StringConvert(ribbonPanel.Text, 1);
                    }

                    if (SystemInfo.CurrentLanguage.Equals("en-US", StringComparison.OrdinalIgnoreCase))
                    {
                        string code = dr[PiModuleTable.FieldCode].ToString();
                        ribbonTabItem.Text = code.StartsWith("Frm", StringComparison.OrdinalIgnoreCase) ? code.Remove(0, 3) : code;
                        ribbonPanel.Text   = code.StartsWith("Frm", StringComparison.OrdinalIgnoreCase) ? code.Remove(0, 3) : code;
                    }
                }

                ribbonTabItem.Panel = ribbonPanel;
                ribbonPanel.Dock    = DockStyle.Fill;
                if (!isSelected)
                {
                    isSelected = true;
                    ribbonTabItem.Select();
                }
                this.ribbonControlMain.Controls.Add(ribbonPanel);
                this.ribbonControlMain.Items.Add(ribbonTabItem);

                DataRow[] subDrows = ClientCache.Instance.DTUserMoule.Select(PiModuleTable.FieldParentId + " = '" + dr[PiModuleTable.FieldId].ToString() + "'", PiModuleTable.FieldSortCode);
                if (subDrows.Length > 0)
                {
                    RibbonBar rb = new RibbonBar();
                    this.LoadSubItems(subDrows, rb, dr[PiModuleTable.FieldId].ToString());
                    ribbonPanel.Controls.Add(rb);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 创建UI层的菜单栏 使用ribbonControl实现菜单栏的功能
        /// </summary>
        /// <param name="Menus"></param>
        private void CreateMenus(Dictionary <string, MyPluginEngine.IMenuDef> Menus)
        {
            //遍历Menu集合中的元素
            foreach (KeyValuePair <string, MyPluginEngine.IMenuDef> menu in Menus)
            {
                MyPluginEngine.IMenuDef nbMenu = menu.Value;
                //新建菜单对象
                //ToolStripMenuItem UIMenu = new ToolStripMenuItem();
                RibbonTabItem UIMenu = new RibbonTabItem();
                //设置菜单属性
                UIMenu.Text           = nbMenu.Caption;
                UIMenu.Tag            = nbMenu;
                UIMenu.AccessibleName = nbMenu.ToString();

                //添加ribbonpanel
                RibbonPanel MenuPanel = new RibbonPanel();
                MenuPanel.Text = nbMenu.Caption;
                MenuPanel.Dock = DockStyle.Fill;
                UIMenu.Panel   = MenuPanel;

                // 添加 ribbonbar
                RibbonBar MenuBar = new RibbonBar();
                //MenuBar.Text = nbMenu.Caption;//分组标题
                //MenuBar.Dock = DockStyle.Fill;

                //将Menu添加MainMenu的Commands中
                //MainMenu.Items.Add(UIMenu);
                //将Command和Tool插入到menu中
                //遍历每一个菜单item
                MyPluginEngine.ItemDef itemDef = new MyPluginEngine.ItemDef();
                for (int i = 0; i < nbMenu.ItemCount; i++)
                {
                    //寻找该菜单对象的信息,如该菜单上的Item数量,是否为Group
                    nbMenu.GetItemInfo(i, itemDef);

                    MyPluginEngine.ITool nbtool = m_DicPlugins[itemDef.ID] as MyPluginEngine.ITool;
                    if (nbtool != null)
                    {
                        //产生一个ITool对象
                        //ToolStripMenuItem UITool = new ToolStripMenuItem();
                        //
                        ButtonItem UITool = new ButtonItem();
                        //根据ITool的信息设置UITool的属性
                        //UITool.ToolTipText = nbtool.Tooltip;
                        UITool.ImagePosition  = DevComponents.DotNetBar.eImagePosition.Top;
                        UITool.Text           = nbtool.Caption;
                        UITool.Image          = nbtool.Bitmap;
                        UITool.AccessibleName = nbtool.ToString();
                        //UITool.Key = nbtool.ToString();
                        UITool.Enabled = nbtool.Enabled;
                        UITool.Checked = nbtool.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbtool.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.UITool_Click方法处理
                        UITool.Click += new EventHandler(UITool_Click);
                        //将生成的UICommand添加到CommandManager中

                        MenuBar.Text = nbtool.Category;
                        if (itemDef.Group)
                        {
                            MenuBar      = new RibbonBar();
                            MenuBar.Text = nbtool.Category;//分组标题
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                        }
                        MenuBar.Items.Add(UITool);
                        //UIMenu.SubItems.Add(UITool);
                    }
                    MyPluginEngine.ICommand nbcmd = m_DicPlugins[itemDef.ID] as MyPluginEngine.ICommand;
                    if (nbcmd != null)
                    {
                        //产生一个UICommand对象
                        //ToolStripMenuItem UICommand = new ToolStripMenuItem();
                        //
                        ButtonItem UICommand = new ButtonItem();
                        UICommand.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                        //根据ICommand的信息设置UICommand的属性
                        //UICommand.ToolTipText = nbcmd.Tooltip;
                        UICommand.Text           = nbcmd.Caption;
                        UICommand.Image          = nbcmd.Bitmap;
                        UICommand.AccessibleName = nbcmd.ToString();
                        UICommand.Enabled        = nbcmd.Enabled;
                        //UICommand的Checked与command的属性一致
                        UICommand.Checked = nbcmd.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbcmd.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.Command_Click方法处理
                        UICommand.Click += new EventHandler(UICommand_Click);
                        //将生成的UICommand添加到CommandManager中
                        //如果分组,则在该UI对象前加上一个分隔符
                        if (itemDef.Group)
                        {
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                            MenuBar      = new RibbonBar();
                            MenuBar.Text = UICommand.Category;
                        }
                        //UIMenu.DropDownItems.Add(UICommand);
                        MenuBar.Items.Add(UICommand);
                    }
                    MenuPanel.Controls.Add(MenuBar);
                }

                this.MainMenu.Controls.Add(MenuPanel);
                this.MainMenu.Items.Add(UIMenu);
            }
        }
Esempio n. 9
0
            /// <summary>
            /// Creates the ribbon menu bar for the html editor.
            /// </summary>
            /// <param name="ribbonMenu">Main ribbon menu.</param>
            public override void CreateRibbonMenuBar(Fluent.Ribbon ribbonMenu)
            {
                foreach (RibbonContextualTabGroup t in ribbonMenu.ContextualGroups)
                {
                    if (t.Name == "tabGroupHtml")
                    {
                        return;
                    }
                }

                // add contextual items for the html editor
                RibbonContextualTabGroup contextualTG = new RibbonContextualTabGroup();

                contextualTG.Name        = "tabGroupHtml";
                contextualTG.BorderBrush = new SolidColorBrush(Colors.Orange);
                contextualTG.Background  = new SolidColorBrush(Colors.OrangeRed);
                contextualTG.Header      = "Html-Editor";

                Binding visibilityBinding = new Binding("ActiveViewModel.SelectedEditorViewModel.IsHtmlEditorViewModelVisible");

                visibilityBinding.Converter = new BooleanToVisibilityConverter();
                visibilityBinding.Mode      = BindingMode.OneWay;
                contextualTG.SetBinding(RibbonContextualTabGroup.VisibilityProperty, visibilityBinding);

                // add the html editor tab item
                RibbonTabItem tab = new RibbonTabItem();

                tab.Group  = contextualTG;
                tab.Header = "Design";

                // font group box
                RibbonGroupBox fontGP = new RibbonGroupBox();

                fontGP.Header = "Font";
                tab.Groups.Add(fontGP);

                #region Button Bold
                Fluent.ToggleButton btnBold = new Fluent.ToggleButton();
                btnBold.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnBold.SizeDefinition = "Large";
                btnBold.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-text-bold-32.png"));
                btnBold.Text = "Bold";

                Binding btnBoldCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlToggleBoldCommand");
                btnBoldCmdn.Mode = BindingMode.OneWay;
                btnBold.SetBinding(Fluent.ToggleButton.CommandProperty, btnBoldCmdn);

                Binding btnBoldIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionTextBold");
                btnBoldIsChecked.Mode = BindingMode.TwoWay;
                btnBold.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnBoldIsChecked);

                fontGP.Items.Add(btnBold);
                #endregion

                #region Button Italic
                Fluent.ToggleButton btnItalic = new Fluent.ToggleButton();
                btnItalic.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnItalic.SizeDefinition = "Large";
                btnItalic.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-text-italic-32.png"));
                btnItalic.Text = "Italic";

                Binding btnItalicCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlToggleItalicCommand");
                btnItalicCmdn.Mode = BindingMode.OneWay;
                btnItalic.SetBinding(Fluent.ToggleButton.CommandProperty, btnItalicCmdn);

                Binding btnItalicIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionTextItalic");
                btnItalicIsChecked.Mode = BindingMode.TwoWay;
                btnItalic.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnItalicIsChecked);

                fontGP.Items.Add(btnItalic);
                #endregion

                #region Button Underline
                Fluent.ToggleButton btnUnderline = new Fluent.ToggleButton();
                btnUnderline.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnUnderline.SizeDefinition = "Large";
                btnUnderline.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-text-underline-32.png"));
                btnUnderline.Text = "Underline";

                Binding btnUnderlineCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlToggleUnderlineCommand");
                btnUnderlineCmdn.Mode = BindingMode.OneWay;
                btnUnderline.SetBinding(Fluent.ToggleButton.CommandProperty, btnUnderlineCmdn);

                Binding btnUnderlineIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionTextUnderlined");
                btnUnderlineIsChecked.Mode = BindingMode.TwoWay;
                btnUnderline.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnUnderlineIsChecked);

                fontGP.Items.Add(btnUnderline);
                #endregion

                // format group box
                RibbonGroupBox formatGP = new RibbonGroupBox();
                formatGP.Header = "Format";
                tab.Groups.Add(formatGP);

                #region Button Decrease Indent
                Fluent.Button btnDecIndent = new Fluent.Button();
                btnDecIndent.SizeDefinition = "Large";
                btnDecIndent.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-indent-less-32.png"));
                btnDecIndent.Text = "Decrease Indent";

                Binding btnDecIndentCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlIndentLessCommand");
                btnDecIndentCmdn.Mode = BindingMode.OneWay;
                btnDecIndent.SetBinding(Fluent.Button.CommandProperty, btnDecIndentCmdn);

                formatGP.Items.Add(btnDecIndent);
                #endregion

                #region Button Increase Indent
                Fluent.Button btnIncIndent = new Fluent.Button();
                btnIncIndent.SizeDefinition = "Large";
                btnIncIndent.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-indent-more-32.png"));
                btnIncIndent.Text = "Increase Indent";

                Binding btnIncIndentCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlIndentMoreCommand");
                btnIncIndentCmdn.Mode = BindingMode.OneWay;
                btnIncIndent.SetBinding(Fluent.Button.CommandProperty, btnIncIndentCmdn);

                formatGP.Items.Add(btnIncIndent);
                #endregion

                // alignment group box
                RibbonGroupBox alignGP = new RibbonGroupBox();
                alignGP.Header = "Alignment";
                tab.Groups.Add(alignGP);

                #region Button Align Left
                Fluent.ToggleButton btnLeft = new Fluent.ToggleButton();
                btnLeft.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnLeft.SizeDefinition = "Large";
                btnLeft.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-justify-left-32.png"));
                btnLeft.Text = "Left";

                Binding btnLeftCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlAlignLeftCommand");
                btnLeftCmdn.Mode = BindingMode.OneWay;
                btnLeft.SetBinding(Fluent.ToggleButton.CommandProperty, btnLeftCmdn);

                Binding btnLeftIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionAlignedLeft");
                btnLeftIsChecked.Mode = BindingMode.TwoWay;
                btnLeft.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnLeftIsChecked);

                alignGP.Items.Add(btnLeft);
                #endregion

                #region Button Align Center
                Fluent.ToggleButton btnCenter = new Fluent.ToggleButton();
                btnCenter.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnCenter.SizeDefinition = "Large";
                btnCenter.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-justify-center-32.png"));
                btnCenter.Text = "Center";

                Binding btnCenterCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlAlignCenterCommand");
                btnCenterCmdn.Mode = BindingMode.OneWay;
                btnCenter.SetBinding(Fluent.ToggleButton.CommandProperty, btnCenterCmdn);

                Binding btnCenterIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionAlignedCenter");
                btnCenterIsChecked.Mode = BindingMode.TwoWay;
                btnCenter.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnCenterIsChecked);

                alignGP.Items.Add(btnCenter);
                #endregion

                #region Button Align Right
                Fluent.ToggleButton btnRight = new Fluent.ToggleButton();
                btnRight.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnRight.SizeDefinition = "Large";
                btnRight.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-justify-right-32.png"));
                btnRight.Text = "Right";

                Binding btnRightCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlAlignRightCommand");
                btnRightCmdn.Mode = BindingMode.OneWay;
                btnRight.SetBinding(Fluent.ToggleButton.CommandProperty, btnRightCmdn);

                Binding btnRightIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionAlignedRight");
                btnRightIsChecked.Mode = BindingMode.TwoWay;
                btnRight.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnRightIsChecked);

                alignGP.Items.Add(btnRight);
                #endregion

                #region Button Align Justify
                Fluent.ToggleButton btnJustify = new Fluent.ToggleButton();
                btnJustify.Margin         = new System.Windows.Thickness(2, 0, 0, 0);
                btnJustify.SizeDefinition = "Large";
                btnJustify.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/format-justify-fill-32.png"));
                btnJustify.Text = "Justify";

                Binding btnJustifyCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlAlignJustifyCommand");
                btnJustifyCmdn.Mode = BindingMode.OneWay;
                btnJustify.SetBinding(Fluent.ToggleButton.CommandProperty, btnJustifyCmdn);

                Binding btnJustifyIsChecked = new Binding("ActiveViewModel.SelectedEditorViewModel.IsSelectionAlignedJustified");
                btnJustifyIsChecked.Mode = BindingMode.TwoWay;
                btnJustify.SetBinding(Fluent.ToggleButton.IsCheckedProperty, btnJustifyIsChecked);

                alignGP.Items.Add(btnJustify);
                #endregion

                // insert group box
                RibbonGroupBox insertGP = new RibbonGroupBox();
                insertGP.Header = "Insert";
                tab.Groups.Add(insertGP);

                #region Button Hyperlink
                Fluent.Button btnHyperlink = new Fluent.Button();
                btnHyperlink.SizeDefinition = "Large";
                btnHyperlink.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/Hyperlink.ico"));
                btnHyperlink.Text = "Hyperlink";

                Binding btnHyperlinkCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlInsertHyperlinkCommand");
                btnHyperlinkCmdn.Mode = BindingMode.OneWay;
                btnHyperlink.SetBinding(Fluent.Button.CommandProperty, btnHyperlinkCmdn);

                insertGP.Items.Add(btnHyperlink);
                #endregion

                #region Button Image
                Fluent.Button btnImage = new Fluent.Button();
                btnImage.SizeDefinition = "Large";
                btnImage.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/insert-image-32.png"));
                btnImage.Text = "Image";

                Binding btnImageCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlInsertImageCommand");
                btnImageCmdn.Mode = BindingMode.OneWay;
                btnImage.SetBinding(Fluent.Button.CommandProperty, btnImageCmdn);

                insertGP.Items.Add(btnImage);
                #endregion

                #region Button List
                Fluent.SplitButton btnList = new SplitButton();
                btnList.SizeDefinition = "Large";
                btnList.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/list-32.png"));
                btnList.Text = "List";
                insertGP.Items.Add(btnList);

                Fluent.Button btnBulletedList = new Fluent.Button();
                btnBulletedList.SizeDefinition = "Middle";
                btnBulletedList.Icon           = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/List_BulletsHS.png"));
                btnBulletedList.Text = "Bulleted List";

                Binding btnBulletedListCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlInsertBulletListCommand");
                btnBulletedListCmdn.Mode = BindingMode.OneWay;
                btnBulletedList.SetBinding(Fluent.Button.CommandProperty, btnBulletedListCmdn);

                btnList.Items.Add(btnBulletedList);

                Fluent.Button btnNumberedList = new Fluent.Button();
                btnNumberedList.SizeDefinition = "Middle";
                btnNumberedList.Icon           = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/List_NumberedHS.png"));
                btnNumberedList.Text = "Numbered List";

                Binding btnNumberedListCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlInsertNumberListCommand");
                btnNumberedListCmdn.Mode = BindingMode.OneWay;
                btnNumberedList.SetBinding(Fluent.Button.CommandProperty, btnNumberedListCmdn);

                btnList.Items.Add(btnNumberedList);
                #endregion

                #region Button Table
                Fluent.Button btnTable = new Fluent.Button();
                btnTable.SizeDefinition = "Large";
                btnTable.LargeIcon      = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("pack://application:,,,/Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions;component/Resources/Images/HtmlEditor/table-32.png"));
                btnTable.Text = "Table";

                Binding btnTableCmdn = new Binding("ActiveViewModel.SelectedEditorViewModel.HtmlInsertTableCommand");
                btnTableCmdn.Mode = BindingMode.OneWay;
                btnTable.SetBinding(Fluent.Button.CommandProperty, btnTableCmdn);

                insertGP.Items.Add(btnTable);
                #endregion

                ribbonMenu.ContextualGroups.Add(contextualTG);
                ribbonMenu.Tabs.Add(tab);

                /*
                 * <fluent:RibbonGroupBox Header="Font">
                 *      <fluent:ToggleButton Text="Bold" Command="{Binding Path=HtmlToggleBoldCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-text-bold-32.png" IsChecked="{Binding Path=IsSelectionTextBold, Mode=TwoWay}" SizeDefinition="Large"/>
                 *      <fluent:ToggleButton Text="Italic" Command="{Binding Path=HtmlToggleItalicCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-text-italic-32.png" IsChecked="{Binding Path=IsSelectionTextItalic, Mode=TwoWay}" SizeDefinition="Large"/>
                 *      <fluent:ToggleButton Text="Underline" Command="{Binding Path=HtmlToggleUnderlineCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-text-underline-32.png" IsChecked="{Binding Path=IsSelectionTextUnderlined, Mode=TwoWay}" SizeDefinition="Large"/>
                 *  </fluent:RibbonGroupBox>
                 *
                 *  <fluent:RibbonGroupBox Header="Format">
                 *      <fluent:Button Text="Decrease Indent" Command="{Binding Path=HtmlIndentLessCommand}" LargeIcon="/Resources/Images/HtmlEditor/format-indent-less-32.png"  SizeDefinition="Large"/>
                 *      <fluent:Button Text="Increase Indent" Command="{Binding Path=HtmlIndentMoreCommand}" LargeIcon="/Resources/Images/HtmlEditor/format-indent-more-32.png" SizeDefinition="Large"/>
                 *  </fluent:RibbonGroupBox>
                 *
                 *  <fluent:RibbonGroupBox Header="Font">
                 *      <fluent:ToggleButton Text="Left" Command="{Binding Path=HtmlAlignLeftCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-justify-left-32.png" IsChecked="{Binding Path=IsSelectionAlignedLeft, Mode=TwoWay}" SizeDefinition="Large"/>
                 *      <fluent:ToggleButton Text="Center" Command="{Binding Path=HtmlAlignCenterCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-justify-center-32.png" IsChecked="{Binding Path=IsSelectionAlignedCenter, Mode=TwoWay}" SizeDefinition="Large"/>
                 *      <fluent:ToggleButton Text="Right" Command="{Binding Path=HtmlAlignRightCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-justify-right-32.png" IsChecked="{Binding Path=IsSelectionAlignedRight, Mode=TwoWay}" SizeDefinition="Large"/>
                 *      <fluent:ToggleButton Text="Justify" Command="{Binding Path=HtmlAlignJustifyCommand}" Margin="2,0,0,0" LargeIcon="/Resources/Images/HtmlEditor/format-justify-fill-32.png" IsChecked="{Binding Path=IsSelectionAlignedJustified, Mode=TwoWay}" SizeDefinition="Large"/>
                 *  </fluent:RibbonGroupBox>
                 *
                 *  <fluent:RibbonGroupBox Header="Insert">
                 *      <fluent:Button Text="Hyperlink" Command="{Binding Path=HtmlInsertHyperlinkCommand}" LargeIcon="/Resources/Images/Ico/Hyperlink.ico"  SizeDefinition="Large"/>
                 *      <fluent:Button Text="Image" Command="{Binding Path=HtmlInsertImageCommand}" LargeIcon="/Resources/Images/HtmlEditor/insert-image-32.png" SizeDefinition="Large"/>
                 *      <fluent:SplitButton Text="List" LargeIcon="/Resources/Images/HtmlEditor/list-32.png" SizeDefinition="Large">
                 *          <fluent:Button Text="Bulleted List" Command="{Binding Path=HtmlInsertBulletListCommand}" Icon="/Resources/Images/HtmlEditor/List_BulletsHS.png" SizeDefinition="Middle"/>
                 *          <fluent:Button Text="Numbered List" Command="{Binding Path=HtmlInsertNumberListCommand}" Icon="/Resources/Images/HtmlEditor/List_NumberedHS.png" SizeDefinition="Middle"/>
                 *      </fluent:SplitButton>
                 *      <fluent:Button Text="Table" Command="{Binding Path=HtmlInsertTableCommand}" LargeIcon="/Resources/Images/HtmlEditor/table-32.png" SizeDefinition="Large"/>
                 *  </fluent:RibbonGroupBox>
                 */
            }
Esempio n. 10
0
 private static string?GetClassString(RibbonTabItem item) => CssBuilder.Default()
 .AddClass("active", item.IsActive)
 .Build();
Esempio n. 11
0
 public static void SetIsTabFromPage(RibbonTabItem item, bool value)
 => item.SetValue(IsTabFromPageProperty, value);
Esempio n. 12
0
        public void showSysMenu()
        {
            //清理模块菜单
            int ritemCount = ribbonControl1.Items.Count - 1;
            for (int i = 0; i < ritemCount; i++)
            {
                ribbonControl1.Items.Remove(0);
            }
            //清理打开的界面
            CloseAllForm();

            for (int i = 0; i < modules.Count; i++)
            {
                #region 循环插入模块
                DevComponents.DotNetBar.RibbonTabItem ribbonTabItemModule = new RibbonTabItem();
                DevComponents.DotNetBar.RibbonPanel rPanel = new RibbonPanel();
                ribbonTabItemModule.Panel = rPanel;
                //this.ribbonControl1.SuspendLayout();
                rPanel.SuspendLayout();
                rPanel.Dock = DockStyle.Fill;
                rPanel.Name = "panel" + modules[i].ModuleId.ToString();
                rPanel.Style.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                rPanel.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                rPanel.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                rPanel.Location = new Point(0, 0x3a);
                rPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
                rPanel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 4);
                rPanel.Size = new Size(0x47a, 0x73);

                //ribbonTabItemModule.Checked = true;
                //ribbonTabItemModule.ItemAlignment = eItemAlignment.Near;
                ribbonTabItemModule.Name = "module" + modules[i].ModuleId.ToString();
                ribbonTabItemModule.Text = modules[i].Name;
                ribbonTabItemModule.Tag = modules[i];
                ribbonTabItemModule.HotFontBold = true;

                DevComponents.DotNetBar.RibbonBar rMenuClass = null;

                #region 增加子菜单
                List<BaseMenu> _menus = menus.FindAll(x => (x.ModuleId == modules[i].ModuleId && x.PMenuId == -1)).OrderByDescending(x => x.SortId).ToList();
                if (_menus.Count > 0)
                {
                    //List<RibbonBar> listbar = new List<RibbonBar>();
                    for (int j = 0; j < _menus.Count; j++)
                    {
                        string dllname= _menus[j].DllName == null ? "" : _menus[j].DllName.Trim();
                        string urlid = _menus[j].UrlId == null ? "" : _menus[j].UrlId.Trim();
                        if (string.IsNullOrEmpty(dllname) && string.IsNullOrEmpty(urlid))
                        {
                            //为二级分类菜单
                            DevComponents.DotNetBar.RibbonBar menuClass = new RibbonBar();
                            menuClass.AutoOverflowEnabled = true;
                            menuClass.Dock = System.Windows.Forms.DockStyle.Left;
                            menuClass.ContainerControlProcessDialogKey = true;
                            menuClass.Text = _menus[j].Name;
                            //menuClass.TitleVisible = false;
                            //三级菜单
                            List<BaseMenu> mainMenu = menus.FindAll(x => x.PMenuId == _menus[j].MenuId).OrderByDescending(x => x.SortId).ToList();
                            foreach (BaseMenu menu in mainMenu)
                            {
                                DevComponents.DotNetBar.ButtonItem btnmenu = new ButtonItem(menu.MenuId.ToString(), menu.Name);
                                // btnmenu.Image = global::EFWBaseLib.Properties.Resources.defaulttool;
                                if (!string.IsNullOrEmpty(menu.Image) && System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + menu.Image))
                                {
                                    btnmenu.Image = new Bitmap(Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + menu.Image), 24, 24);
                                }
                                else
                                {
                                    btnmenu.Image = MainUI.Winform.Properties.Resources.page;
                                }
                                // btnmenu.ImageListSizeSelection = DevComponents.DotNetBar.eButtonImageListSelection.Large;
                                btnmenu.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                                btnmenu.Text = menu.Name;
                                btnmenu.Tag = menu;
                                btnmenu.ImageListSizeSelection = eButtonImageListSelection.Default;
                                //btnmenu.ImagePosition = eImagePosition.Left;
                                btnmenu.Click += new EventHandler(btnmenu_Click);
                                menuClass.Items.Add(btnmenu);
                            }

                            //listbar.Add(menuClass);
                            rPanel.Controls.Add(menuClass);

                            //rPanel.Refresh();
                        }
                        else
                        {
                            //菜单没有二级分类菜单则创建默认二级分类菜单
                            if (rMenuClass == null)
                            {
                                rMenuClass = new RibbonBar();
                                rMenuClass.AutoOverflowEnabled = true;
                                rMenuClass.Dock = System.Windows.Forms.DockStyle.Left;
                                rMenuClass.Text = "操作功能";
                                rMenuClass.TitleVisible = false;
                                rPanel.Controls.Add(rMenuClass);
                            }

                            DevComponents.DotNetBar.ButtonItem btnmenu = new ButtonItem(_menus[j].MenuId.ToString(), _menus[j].Name);
                            //btnmenu.Image = global::EFWBaseLib.Properties.Resources.defaulttool;
                            //btnmenu.ImageListSizeSelection = DevComponents.DotNetBar.eButtonImageListSelection.Large;
                            if (!string.IsNullOrEmpty(_menus[j].Image))
                            {
                                btnmenu.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + _menus[j].Image);
                                btnmenu.Image = new Bitmap(Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + _menus[j].Image), 32, 32);
                            }
                            else
                            {
                                btnmenu.Image = MainUI.Winform.Properties.Resources.page;
                            }
                            btnmenu.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                            btnmenu.Text = _menus[j].Name;
                            btnmenu.Tag = _menus[j];
                            btnmenu.Click += new EventHandler(btnmenu_Click);
                            rMenuClass.Items.Add(btnmenu);
                        }
                    }
                }
                #endregion

                ribbonControl1.Items.Insert(ribbonControl1.Items.Count - 1, ribbonTabItemModule);
                ribbonControl1.Controls.Add(rPanel);

                rPanel.ResumeLayout(false);
                ribbonTabItemModule.Refresh();

                #endregion
            }

            ribbonControl1.Show();
            //ribbonTabItem1.Visible = false;
            //ribbonTabItem2.Visible = false;
            ribbonControl1.Refresh();
            this.Refresh();
            ribbonControl1.SelectFirstVisibleRibbonTab();

        }
Esempio n. 13
0
        private void BuildMenu()
        {
            //ribbonControl1.Controls.Clear();
            //ribbonControl1.SuspendLayout();
            Dictionary <string, List <SystemMenu> > dt = Framework.Environment.GetSystemMenu();
            List <BaseItem> list = new List <BaseItem>();

            foreach (var item in dt)
            {
                DevComponents.DotNetBar.RibbonTabItem ribbonTabItem = new RibbonTabItem();
                DevComponents.DotNetBar.RibbonPanel   ribbonPanel   = new RibbonPanel();
                ribbonTabItem.Name           = "ribbonTabItem" + item.Key;
                ribbonTabItem.Panel          = ribbonPanel;
                ribbonTabItem.Text           = item.Key;
                ribbonPanel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
                List <Control> barlist = new List <Control>();
                foreach (var item1 in item.Value)
                {
                    DevComponents.DotNetBar.RibbonBar ribbonBar = new RibbonBar();
                    ribbonBar.AutoOverflowEnabled = true;
                    ribbonBar.BackgroundMouseOverStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonBar.BackgroundStyle.CornerType          = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonBar.ContainerControlProcessDialogKey    = true;
                    ribbonBar.Dock = System.Windows.Forms.DockStyle.Left;
                    DevComponents.DotNetBar.ButtonItem buttonItem = new ButtonItem();
                    buttonItem.Name = "buttonItem" + item1.Title;
                    buttonItem.SubItemsExpandWidth = 14;
                    buttonItem.Text    = item1.Title;
                    buttonItem.Click  += new System.EventHandler(buttonItem_Click);
                    buttonItem.Tooltip = item1.Discription;
                    buttonItem.Tag     = item1;

                    ribbonBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { buttonItem });
                    ribbonBar.Location = new System.Drawing.Point(3, 0);
                    ribbonBar.Name     = "ribbonBar" + item1.Title;
                    ribbonBar.Size     = new System.Drawing.Size(67, 95);
                    ribbonBar.Style    = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
                    ribbonBar.Text     = item1.Title;
                    ribbonBar.TitleStyle.CornerType          = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonBar.TitleStyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonBar.TabIndex = tapindex++;
                    barlist.Add(ribbonBar);
                }
                ribbonPanel.Controls.AddRange(barlist.ToArray());
                for (int i = 0; i < ribbonPanel.Controls.Count; i++)
                {
                    ribbonPanel.Controls.SetChildIndex(barlist[i], i);
                }
                ribbonPanel.Dock                      = System.Windows.Forms.DockStyle.Fill;
                ribbonPanel.Location                  = new System.Drawing.Point(0, 53);
                ribbonPanel.Name                      = "ribbonPanel" + item.Key;
                ribbonPanel.Padding                   = new System.Windows.Forms.Padding(3, 0, 3, 3);
                ribbonPanel.Size                      = new System.Drawing.Size(1029, 98);
                ribbonPanel.Style.CornerType          = DevComponents.DotNetBar.eCornerType.Square;
                ribbonPanel.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                ribbonPanel.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                //ribbonPanel.BringToFront();
                list.Add(ribbonTabItem);
                ribbonControl1.Controls.Add(ribbonPanel);
            }
            ribbonControl1.Items.InsertRange(0, list.ToArray());
            ribbonControl1.SelectFirstVisibleRibbonTab();
            ribbonControl1.Refresh();
        }