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. [PKUWC 2018]随机算法

    Description 题库链接 给定一张有 \(n\) 个点 \(m\) 条边的无向图,生成 \(1\sim n\) 的全排列,假设一个排列是 \(p\) , \(S\) 是当前最大独立集:如果 \ ...

  2. Ionic项目中如何使用Native Camera

    本文介绍如何在ionic项目中使用设备的camera. Ionic版本:v3.2.0 / 2017-05-10 / MIT Licensed / Release Notes ============= ...

  3. 使用Python制作一个简单的刷博器

    呵呵,不得不佩服Python的强大,寥寥几句代码就能做一个简单的刷博器. import webbrowser as web import time import os count=0 while co ...

  4. vs2013 sn key

    BWG7X-J98B3-W34RT-33B3R-JVYW9  

  5. Spring-boot简单的理解

    SpringBoot启动 SpringApplication.run(MyBootApplication.class); SpringApplication.run启动SpringBoot应用,主要过 ...

  6. Springboot拦截器未起作用

    之前遇到要使用springboot拦截器却始终未生效的状况,查了网上的博客,大抵都是@Component,@Configuration注解未加,或是使用@ComponentScan增加包扫描,但是尝试 ...

  7. SQL Server删除表及删除表中数据的方法

    删除表的T-SQL语句为: drop table <表名> drop是丢弃的意思,drop table表示将一个表彻底删除掉. 删除表数据有两种方法:delete和truncate. de ...

  8. substr与substring的区别

    在js中字符截取函数有常用的三个slice().substring().substr()了,下面我来给大家介绍slice().substring().substr()函数在字符截取时的一些用法与区别吧 ...

  9. CSS属性之attr()

    attr()准确的说,不应该是一个属性,而是一个CSS的函数,我们先看看MDN上的介绍吧: Summary The attr() CSS function is used to retrieve th ...

  10. p2p状态码

    因为需要的确定状态太多,减少数据库的压力,采取二进制表示状态码 状态码工具类 package com.xmg.p2p.base.util; /** * 用户状态类,记录用户在平台使用系统中所有的状态. ...