传统界面设计(不同于ribbon):BarManager管理菜单栏、工具栏和状态栏的管理器
来源:互联网 发布:php从入门到放弃 编辑:程序博客网 时间:2024/06/05 20:14
Assembly:DevExpress.XtraBars.v14.1.dll
BarManager 是 XtraBars Library.最重要元素。 It is a container for bar items, categories and bars. For every form you want to place bars on, you should place a BarManager component .
要在运行时激活自定义(工具管理)窗口 ,调用Customize 方法.
BarManager 提供保存和恢复工具布局到注册表的辅助工具. 保存布局, 调用 SaveToRegistry 方法, and RestoreFromRegistry 恢复布局. 在保存和加载之前,需指定注册表路径( RegistryPath 属性).
XtraBars 引入 BarAndDockingController 来保存程序总工具条的自定义和外观设置.BarAndDockingController 提供默认设置 . 也就是说这些设置都可以被独立设置覆盖。BarAndDockingController 允许你实现 centralized control over the bars settings. 默认所有工具条通过BarAndDockingController得到设置. 获取和定制默认控制器通过静态 BarAndDockingController.Default 属性或通过DefaultBarAndDockingController 组件.
If you need to provide different settings for bars residing within specific forms, as compared to bars within other forms, you need to create new BarAndDockingController objects and assign them to the Controller properties of the required BarManagers. In this case, bars will get their settings from this controller and not from the default controller. The GetController function returns the actual controller providing a bar's settings.
设计时拖放 BarManager 到窗体,所有控件公开 PopupContextMenu 扩展属性 (属性窗口中的标题像 'PopupContextMenu on barManager1')一样. 可以使用此属性给控件关联PopupMenu orRadialMenu . 右击时将显示该菜单
代码关联弹出菜单, 调用 SetPopupContextMenu 方法.可以在弹出菜单显示前定制菜单,通过处理 QueryShowPopupMenu 事件
某些特定复杂的控件such as XtraGrid and XtraTreeList 不公开 PopupContextMenu 属性, as these controls support different context menus for different visual elements. See the help documentation on these products to learn how to work with context menus in these controls.
不允许添加两个或多个 BarManager 组件到同一窗体或用户控件.
不推荐常规工具条 ( BarManager 组件) 和 RibbonControl 在同一窗体或用户控件中同时使用, 可能会冲突.
示例1 :个人实践
新建窗体项目,拖动BarManager到窗体设计器,会自动显示菜单栏和工具栏和状态栏(都是XtraBars.Bar),默认name工具栏bar1,BarName=Tools,菜单栏bar2,BarName=Main Menu,状态栏bar3,BarName=Statusbar。
BarManager属性里只可以看到MainMenu和StatusBar。
因为每个Form仅有一个主菜单和状态栏,而ToolBar可以有多个,即自定义工具。(CustomBar)
How to obtain a value of the BarEditItem during editing
Object value=(barManager1.ActiveEditor as DevExpress.XtraEditors.ButtonEdit).EditValue;
工具栏通过Bars集合添加. 工具栏项通过 Bar.AddItem and Bar.AddItems 方法添加。
避免添加和定制工具栏和功能项时闪烁,处理定制的代码通过, BeginUpdate and EndUpdate 方法调用进行闭合操作。
添加子菜单通过单击,并选择添加Menu(BarSubItem),命名subMenuFile、subMenuEdit、subMenu+名称
添加菜单项通过选择具体的功能控件就OK,命名 空间类型+(子菜单名)+功能名,如buttonOpen、buttonViewOutput。
通过设计器将同一个功能项同时指向菜单和工具栏没找到?????
官方文档:示例展示如何通过代码创建工具条和工具条选项。
创建两个工具条-主菜单(工具条扩展到匹配窗口宽度)和常规工具条. 主菜单包含三个子菜单 (File, Edit and View), 每个有自己的功能项. 第二个工具条为工具栏,显示 Output 按钮, Output项也可以通过主菜单的View视图子菜单获取:
工具栏通过Bars集合添加. 工具栏项通过 Bar.AddItem and Bar.AddItems 方法添加。
避免添加和定制工具栏和功能项时闪烁,处理定制的代码通过, BeginUpdate and EndUpdate 方法调用进行闭合操作。
处理功能项的单击事件
private void btnViewOutput_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //处理某一项 }// 放在barManager的ItemClick处理,可以集中处理所有的 private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DevExpress.XtraBars.BarSubItem subMenu = e.Item as DevExpress.XtraBars.BarSubItem; if (subMenu != null) return; MessageBox.Show("Item '" + e.Item.Caption + "' has been clicked"); }
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
ComponentEditorContainer
BarManager
PrintBarManager
DevExpress.XtraBars.Ribbon.RibbonBarManager
DevExpress.XtraBars Namespace
Bar
BarItem
BarItemLink
BarAndDockingController
Bar Manager
Bar and Docking Controller
- 传统界面设计(不同于ribbon):BarManager管理菜单栏、工具栏和状态栏的管理器
- 菜单栏、工具栏和状态栏
- C#Windows窗体界面设计_05_添加菜单栏 工具栏 状态栏 按钮
- MFC基于对话框的菜单栏,工具栏和状态栏的创建
- MFC的对话框工具栏、状态栏、和菜单栏的编辑
- MFC 2008,新的用户界面 - 3 - 菜单栏、工具栏和状态栏
- Qt中实现简单的菜单栏,工具栏和状态栏!
- MFC 2008,新的用户界面(3)- 菜单栏、工具栏和状态栏
- PyQt5的菜单栏,工具栏,状态栏的合并
- 对话框(dialog)、菜单栏、工具栏、状态栏
- 菜单栏和工具栏的创建
- JavaSwing实现完整的菜单栏、工具栏和状态栏的GUI窗口
- 添加菜单栏、工具栏按钮、状态栏,并将菜单栏和工具栏关联
- Qt 学习之路 2(12):菜单栏、工具栏和状态栏
- 在Windows应用程序中设计菜单栏、工具栏和状态栏
- QT5 学习之路16---菜单栏、工具栏和状态栏
- Qt学习之八:菜单栏、工具栏和状态栏
- PyQt5学习记录(2)---QMainWindow菜单栏、状态栏和工具栏
- Java 实现二叉树的建立以及前、中、后序遍利
- 一觉夏眠不知晓
- NYOJ1036 非洲小孩(区间选点问题)
- cocoStudio工具的使用-----场景编辑器
- 使用R7版NDK搭建Android开发环境
- 传统界面设计(不同于ribbon):BarManager管理菜单栏、工具栏和状态栏的管理器
- ZJU-PAT 1081. Rational Sum (20)
- 设计模式之门面模式
- zend framework多模块多Layout配置
- Tomcat 请求数据 乱码问题
- ORA-12514:TNS:监听程序当前无法识别连接描述符中请求的服务
- Qt模块化笔记之core——事件QEvent
- leetcode-Largest Rectangle in Histogram
- uva 10061 How many zero's and how many digits ?(不同进制阶乘末尾几个0)+poj 1401