当前位置: 首页>后端>正文

DevExpress Ribbon 两种下拉菜单的实现

DevExpress Ribbon 两种下拉菜单的实现,第1张
ribbonDorp.gif

两种方式实现下拉选择框

  1. 用 BarButtonItem.DropDownControl; 可以实现非菜单的下来选框

  2. 用 BarSubItem

     /// <summary>
     /// Required method for Designer support - do not modify
     /// the contents of this method with the code editor.
     /// </summary>
     private void InitializeComponent()
     {
         this.components = new System.ComponentModel.Container();
         System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
         this.ribbonMainPage = new DevExpress.XtraBars.Ribbon.RibbonControl();
         this.btnNewSolution = new DevExpress.XtraBars.BarButtonItem();
         this.newOfAppMenu = new DevExpress.XtraBars.PopupMenu(this.components);
         this.bsiLayouts = new DevExpress.XtraBars.BarSubItem();
         this.barBtnItem = new DevExpress.XtraBars.BarCheckItem();
         this.btnNewSubWindow = new DevExpress.XtraBars.BarButtonItem();
         this.ribbonPageGroup11 = new DevExpress.XtraBars.Ribbon.RibbonPageGroup();
         this.ribbonPageModo = new DevExpress.XtraBars.Ribbon.RibbonPage();
         this.barAndDockingController1 = new DevExpress.XtraBars.BarAndDockingController(this.components);
         ((System.ComponentModel.ISupportInitialize)(this.barAndDockingController1)).BeginInit();
         ((System.ComponentModel.ISupportInitialize)(this.newOfAppMenu)).BeginInit();
         ((System.ComponentModel.ISupportInitialize)(this.ribbonMainPage)).BeginInit();
         this.SuspendLayout();
         // 
         // ribbonMainPage
         // 
         this.ribbonMainPage.ApplicationButtonText = "文件";
         this.ribbonMainPage.ApplicationCaption = "";
         this.ribbonMainPage.ApplicationDocumentCaption = "";
         this.ribbonMainPage.AutoHideEmptyItems = true;
         this.ribbonMainPage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(91)))), ((int)(((byte)(135)))));
         this.ribbonMainPage.Controller = this.barAndDockingController1;
         this.ribbonMainPage.ExpandCollapseItem.Id = 0;
         this.ribbonMainPage.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
             this.btnNewSolution
         });
         this.ribbonMainPage.ItemsVertAlign = DevExpress.Utils.VertAlignment.Bottom;
         this.ribbonMainPage.Location = new System.Drawing.Point(0, 0);
         this.ribbonMainPage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
         this.ribbonMainPage.MaxItemId = 388;
         this.ribbonMainPage.Name = "ribbonMainPage";
         this.ribbonMainPage.PageHeaderMinWidth = 75;
         this.ribbonMainPage.Pages.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPage[] {
         this.ribbonPageModo});
         this.ribbonMainPage.RibbonCaptionAlignment = DevExpress.XtraBars.Ribbon.RibbonCaptionAlignment.Center;
         this.ribbonMainPage.ShowQatLocationSelector = false;
         this.ribbonMainPage.Size = new System.Drawing.Size(1384, 158);
         this.ribbonMainPage.ToolbarLocation = DevExpress.XtraBars.Ribbon.RibbonQuickAccessToolbarLocation.Above;
         // 
         // barAndDockingController1
         // 
         this.barAndDockingController1.AppearancesDocking.PanelCaption.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
         this.barAndDockingController1.AppearancesDocking.PanelCaption.Options.UseFont = true;
         this.barAndDockingController1.AppearancesDocking.PanelCaptionActive.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
         this.barAndDockingController1.AppearancesDocking.PanelCaptionActive.Options.UseFont = true;
         this.barAndDockingController1.AppearancesDocumentManager.View.BackColor = System.Drawing.Color.White;
         this.barAndDockingController1.AppearancesDocumentManager.View.Options.UseBackColor = true;
         this.barAndDockingController1.AppearancesRibbon.FormCaption.Font = new System.Drawing.Font("Tahoma", 12F);
         this.barAndDockingController1.AppearancesRibbon.FormCaption.Options.UseFont = true;
         this.barAndDockingController1.AppearancesRibbon.Item.Options.UseTextOptions = true;
         this.barAndDockingController1.AppearancesRibbon.Item.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
         this.barAndDockingController1.LookAndFeel.SkinName = "My Basic";
         this.barAndDockingController1.LookAndFeel.UseDefaultLookAndFeel = false;
         this.barAndDockingController1.PaintStyleName = "Skin";
         this.barAndDockingController1.PropertiesBar.AllowLinkLighting = false;
         this.barAndDockingController1.PropertiesDocking.SnapMode = ((DevExpress.Utils.Controls.SnapMode)((((DevExpress.Utils.Controls.SnapMode.OwnerControl | DevExpress.Utils.Controls.SnapMode.OwnerForm)
         | DevExpress.Utils.Controls.SnapMode.Screens)
         | DevExpress.Utils.Controls.SnapMode.SnapForms)));
         // 
         // ribbonPageDraw
         // 
         this.ribbonPageModo.Groups.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPageGroup[] {
         this.ribbonPageGroup11
         });
         this.ribbonPageModo.Name = "ribbonPageModo";
         this.ribbonPageModo.Tag = "Draw";
         this.ribbonPageModo.Text = "绘制";
         // 
         // ribbonPageGroup11
         // 
         this.ribbonPageGroup11.ItemLinks.Add(this.bsiLayouts);
         this.ribbonPageGroup11.ItemLinks.Add(this.btnNewSubWindow);
         this.ribbonPageGroup11.ItemsLayout = DevExpress.XtraBars.Ribbon.RibbonPageGroupItemsLayout.TwoRows;
         this.ribbonPageGroup11.Name = "ribbonPageGroup11";
         this.ribbonPageGroup11.Text = "曲线工具";
         // 
         // btnNewSubWindow
         // 
         this.btnNewSubWindow.ActAsDropDown = true;
         this.btnNewSubWindow.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.DropDown;
         this.btnNewSubWindow.Caption = "新建子窗口";
         this.btnNewSubWindow.DropDownControl = this.newOfAppMenu;
         this.btnNewSubWindow.Id = 191;
         this.btnNewSubWindow.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnNewSubWindow.ImageOptions.Image")));
         this.btnNewSubWindow.ImageOptions.SvgImage = global::Catlab.Properties.Resources.新建子窗口;
         this.btnNewSubWindow.Name = "btnNewSubWindow";
         this.btnNewSubWindow.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonItemStyles.Large;
         // 
         // newOfAppMenu
         // 
         this.newOfAppMenu.ItemLinks.Add(this.btnNewSolution);
         this.newOfAppMenu.Name = "newOfAppMenu";
         this.newOfAppMenu.Ribbon = this.ribbonMainPage;
         // 
         // btnNewSolution
         // 
         this.btnNewSolution.Caption = "工程(Project)";
         this.btnNewSolution.Id = 377;
         this.btnNewSolution.Name = "btnNewSolution";
         this.btnNewSolution.Tag = "PROJECT";
         // 
         // bsiLayouts
         // 
         this.bsiLayouts.Caption = "选择布局";
         this.bsiLayouts.ImageOptions.SvgImage = global::Catlab.Properties.Resources.窗口布局;
         this.bsiLayouts.Name = "bbiLayouts";
         this.bsiLayouts.ShowNavigationHeader = DevExpress.Utils.DefaultBoolean.True;
         this.bsiLayouts.AddItem(this.barBtnItem);
         // 
         // barBtnItem
         // 
         this.barBtnItem.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.Default;
         this.barBtnItem.Caption = "layout";
         this.barBtnItem.Name = "layout";
         this.barBtnItem.Visibility = BarItemVisibility.Always;
         // 
         // Form
         // 
         this.Controls.Add(this.ribbonMainPage);
         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
         this.ClientSize = new System.Drawing.Size(800, 450);
         this.Text = "RibbonControlForm";
         this.Ribbon = this.ribbonMainPage;
         ((System.ComponentModel.ISupportInitialize)(this.barAndDockingController1)).EndInit();
         ((System.ComponentModel.ISupportInitialize)(this.ribbonMainPage)).EndInit();
         ((System.ComponentModel.ISupportInitialize)(this.newOfAppMenu)).EndInit();
         this.ResumeLayout(false);
         this.PerformLayout();
     }
    
     #endregion
    
     private DevExpress.XtraBars.BarAndDockingController barAndDockingController1;
     private DevExpress.XtraBars.Ribbon.RibbonControl ribbonMainPage;
     private DevExpress.XtraBars.Ribbon.RibbonPage ribbonPageModo;
     private DevExpress.XtraBars.Ribbon.RibbonPageGroup ribbonPageGroup11;
     private DevExpress.XtraBars.BarButtonItem btnNewSubWindow;
     private DevExpress.XtraBars.BarButtonItem btnNewSolution;
     private DevExpress.XtraBars.PopupMenu newOfAppMenu;
     private DevExpress.XtraBars.BarSubItem bsiLayouts;
     private DevExpress.XtraBars.BarCheckItem barBtnItem;
    

https://www.xamrdz.com/backend/3qf1941373.html

相关文章: