RibbonControl

常用操作

1、如何代码显示选中的页

ribbonControl1.SelectedPage = ribbonPage2;

2、如何绑定ApplicationMenus和PopupMenu:

通过ribbonControl上的PopupContextMenu进行绑定;


如何代码创建RibbonContrl

效果如下:


代码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors; using DevExpress.XtraBars.Ribbon; using DevExpress.XtraBars; namespace DXApplication_1
{
public partial class RibbonCtrolForm2 : DevExpress.XtraEditors.XtraForm
{
public RibbonCtrolForm2()
{
InitializeComponent();
} private void RibbonCtrolForm2_Load(object sender, EventArgs e)
{
// Create a RibbonControl RibbonControl RibbonControl = new RibbonControl(); this.Controls.Add(RibbonControl); // Assign the image collection that will provide images for bar items. RibbonControl.Images = imageCollection1; // Create a Ribbon page.
RibbonPage page1 = new RibbonPage("Home"); // Create a Ribbon page group.
RibbonPageGroup group1 = new RibbonPageGroup("File");
// Create another Ribbon page group.
RibbonPageGroup group2 = new RibbonPageGroup("File 2"); // Create a button item using the CreateButton method.
// The created item is automatically added to the item collection of the RibbonControl.
BarButtonItem itemOpen = RibbonControl.Items.CreateButton("Open...");
itemOpen.ImageIndex = ;
itemOpen.ItemClick += new ItemClickEventHandler(itemOpen_ItemClick); // Create a button item using its constructor.
// The constructor automatically adds the created item to the RibbonControl's item collection.
BarButtonItem itemClose = new BarButtonItem(RibbonControl.Manager, "Close");
itemClose.ImageIndex = ;
itemClose.ItemClick += new ItemClickEventHandler(itemClose_ItemClick); // Create a button item using the default constructor.
BarButtonItem itemPrint = new BarButtonItem();
// Manually add the created item to the item collection of the RibbonControl.
RibbonControl.Items.Add(itemPrint);
itemPrint.Caption = "Search";
itemPrint.ImageIndex = ;
itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick); // Add the created items to the group using the AddRange method.
// This method will create bar item links for the items and then add the links to the group.
group1.ItemLinks.AddRange(new BarItem[] { itemOpen, itemClose, itemPrint });
// Add the Open bar item to the second group.
group2.ItemLinks.Add(itemOpen); // Add the created groups to the page.
page1.Groups.Add(group1);
page1.Groups.Add(group2); // Add the page to the RibbonControl.
RibbonControl.Pages.Add(page1);
} void itemPrint_ItemClick(object sender, ItemClickEventArgs e)
{
} void itemClose_ItemClick(object sender, ItemClickEventArgs e)
{
} void itemOpen_ItemClick(object sender, ItemClickEventArgs e)
{
}
}
}

DevExpress02、RibbonControl的更多相关文章

  1. WPF仿Word头部格式,涉及DEV RibbonControl,NarvbarControl,ContentPresenter,Navigation

    时隔1个月,2015/06/17走进新的环境. 最近一个星期在学习仿Word菜单栏的WPF实现方式,废话不多说,先看一下效果. 打开界面后,默认选中[市场A],A对应的菜单栏,如上图, 选择[市场B] ...

  2. DevExpress中RibbonControl的简单应用

    现在介绍一下DevExpress中的RibbonControl的简单应用,搭建一个拥有Office2010风格的窗体程序. 第一步:打开VS2015,新建一个windows窗体应用程序: 第二步:把需 ...

  3. XtraEditors四、TextEdit、ButtonEdit、PictureEdit、RadioGroup、PopupContainerEdit

    TextEdit控件 以文本框的形式绑定各种形式的选择框: 文本框设置 输入 密码 字符 时, 要有 * 号掩盖输入的字符, 代码如下: textEdit1.Properties.PasswordCh ...

  4. DevExpress06、Popup Menus、RadialMenu、XtraTabControl、SplitContainerControl、GroupControl

    Popup Menus 弹出菜单 使用弹出菜单(popup menus),我们可以在   控件上   显示   上下文选项   或  命令. 弹出菜单是一个显示了特定项的窗体,用户可以选择这些项以执行 ...

  5. DevExpress01:Bar Manager,bar 、Toolbars

    Bar Manager : 不可见的控件 如果想在窗体或用户控件添加工具条或弹出菜单,我们需要把一个不可见的控件 BarManager拖放到这个窗体或用户控件上. 这个BarManager控件维护工具 ...

  6. js-静态、原型、实例属性

    本篇来说一下js中的属性: 1.静态属性 2.原型属性 3.实例属性 静态属性: function klass(){} var obj=new klass(); klass.count=0; klas ...

  7. 【.net 深呼吸】细说CodeDom(2):表达式、语句

    在上一篇文章中,老周厚着脸皮给大伙介绍了代码文档的基本结构,以及一些代码对象与CodeDom类型的对应关系. 在评论中老周看到有朋友提到了 Emit,那老周就顺便提一下.严格上说,Emit并不是针对代 ...

  8. javascript中的Array对象 —— 数组的合并、转换、迭代、排序、堆栈

    Array 是javascript中经常用到的数据类型.javascript 的数组其他语言中数组的最大的区别是其每个数组项都可以保存任何类型的数据.本文主要讨论javascript中数组的声明.转换 ...

  9. IE6、7下html标签间存在空白符,导致渲染后占用多余空白位置的原因及解决方法

    直接上图:原因:该div包含的内容是靠后台进行print操作,输出的.如果没有输出任何内容,浏览器会默认给该空白区域添加空白符.在IE6.7下,浏览器解析渲染时,会认为空白符也是占位置的,默认其具有字 ...

随机推荐

  1. SQL 修改表字段失败 解决方法

    OK  大功告成 !!!

  2. 通向全栈之路——(5)git通三端

    一.在私有git服务中新建一个项目(码云):将电脑上id_rsa.pub(git公钥)拷贝至ssh下面中保存二.本地代码关联git:1.git全局设置:git config --global user ...

  3. 中国移动CMPP协议错误码

    中国移动CMPP协议错误码 状态码 说明                             出现次数高 DELIVRD 消息发送成功 用户成功接收到短信 REJECTD 消息因为某些原因被拒绝不 ...

  4. [日常] MySQL的哈希索引和原理研究测试

    1.哈希索引 :(hash index)基于哈希表实现,只有精确匹配到索引列的查询,才会起到效果.对于每一行数据,存储引擎都会对所有的索引列计算出一个哈希码(hash code),哈希码是一个较小的整 ...

  5. 比较ArrayList和LinkedList的异同

    1.ArrayList是实现了基于动态数组的数据结构,而LinkedList是基于链表的数据结构: 2.对于随机访问get和set,ArrayList要优于LinkedList; 3.对于添加和删除操 ...

  6. 请整体描述Java异常体系

    java把异常当做对象来处理,并定义一个基类Throwable作为所有异常的超类.在java API中已经定义了许多异常的类,这些异常分为两大类,错误Error和异常Exception.其中异常Exc ...

  7. java获得Tomcat服务器的根目录下的内容

    File f2=new File(System.getProperty("catalina.home")+ File.separator+"webapps"+F ...

  8. php5.6+apache2.4+linux搭建php环境

    前言 最近突然想搭建个人博客,尽管笔者擅长java-web,但综合各种原因,于是选择了大众化的php+mysql搭建个人博客.对于php,只闻其大名,但从未学过,于是,笔者将从php环境搭建开始,到服 ...

  9. Java 如何重写对象的 equals 方法和 hashCode 方法

    前言:Java 对象如果要比较是否相等,则需要重写 equals 方法,同时重写 hashCode 方法,而且 hashCode 方法里面使用质数 31.接下来看看各种为什么. 一.需求: 对比两个对 ...

  10. IDEA使用总结1-Github下载代码和上传代码到Git

    1. 首先你需要在IDEA中创建一个项目,创建完项目后使能版本管理插件 选择git后创建本地git仓库成功,提示如下 2.第二步 commit代码到 commit时会提示是否需要进行检查什么的 3.第 ...