delphi ribbon使用
http://blog.csdn.net/davinciyxw/article/details/5604209
1.TextEditor(barEditItem)取文本
string editValue = barEditItem1.EditValue.ToString(); //错误,返回null
string editValue = ((DevExpress.XtraEditors.TextEdit)barEditItem).EditValue.ToString(); //正确,返回文本框内容
2.ComboBoxEdit(barEditItem)添加Item
string item = "comboboxItem1";
((DevExpress.XtraEditors.Repository.RepositoryItemComboBox)this.barEditItem.Edit).Items.Add(item);
3.ComboBoxEdit(barEditItem)取文本
string itemValue = this.barEditItem.EditValue.ToString();
4.Ribbon控件
//添加Page
DevExpress.XtraBars.Ribbon.RibbonPage ribbonPage = new RibbonPage();
ribbonControl.Pages.Add(ribbonPage);
//添加Group
DevExpress.XtraBars.Ribbon.RibbonPageGroup ribbonPageGroup = new RibbonPageGroup();
ribbonPage.Groups.Add(ribbonPageGroup);
//添加Button
DevExpress.XtraBars.BarButtonItem barButtonItem = new BarButtonItem();
ribbonPageGroup.ItemLinks.Add(barButtonItem);
//添加barSubItem
DevExpress.XtraBars.BarSubItem barSubItem = new BarSubItem();
ribbonPageGroup.ItemLinks.Add(barSubItem);
//barSubItem下添加Button
barSubItem.AddItem(barButtonItem);
//奇怪的删除Page问题
while (this.ribbonControl.Pages.Count > 0)
{
ribbonControl.Pages.Remove(ribbonControl.Pages[0]); //调试正常,运行报异常
}
while (this.ribbonControl.Pages.Count > 0)
{
ribbonControl.SelectedPage = ribbonControl.Pages[0];
ribbonControl.Pages.Remove(ribbonControl.SelectedPage); //运行正常
}
//禁止F10键Tips
ribbonControl.Manager.UseF10KeyForMenu = false;
//DX按钮
ApplicationIcon属性改变图标
右键 Add ApplicationMenu 添加evExpress.XtraBars.Ribbon.ApplicationMenu
5.HitInfo
//在Tab页上点击右键的事件响应
void xtraTabbedMdiManager_Event(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && ActiveMdiChild != null)
{
DevExpress.XtraTab.ViewInfo.BaseTabHitInfo hInfo = xtraTabbedMdiManager.CalcHitInfo(e.Location);
//右键点击位置:在Page上且不在关闭按钮内
if (hInfo.IsValid && hInfo.Page != null && !hInfo.InPageCloseButton)
{
this.popupMenu.ShowPopup(Control.MousePosition);//在鼠标位置弹出,而不是e.Location
}
}
}
//在ribbon上点击右键的事件响应
private void ribbonControl1_ShowCustomizationMenu(object sender, RibbonCustomizationMenuEventArgs e)
{
//禁掉原系统右键菜单
e.ShowCustomizationMenu = false;
//右键位置:在barButtonItem上
if (e.HitInfo != null
&& e.HitInfo.InItem
&& e.HitInfo.Item.Item is BarButtonItem)
{
this.popupMenu.ShowPopup(Control.MousePosition);
}
//右键位置:在barSubItem中的barButtonItem上
else if (e.Link != null
&& e.Link.Item != null
&& e.Link.Item is BarButtonItem)
{
this.popupMenu.ShowPopup(Control.MousePosition);
}
}
6.皮肤
//添加皮肤程序集后注册皮肤
DevExpress.UserSkins.OfficeSkins.Register();
DevExpress.UserSkins.BonusSkins.Register();
//设置皮肤
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Liquid Sky"); //若皮肤名称错误则按系统默认设置(第一个皮肤)
//GalleryFilterMenuPopup事件设置弹出筛选菜单的“All Groups”为中文
private void rgbiSkins_GalleryFilterMenuPopup(object sender, GalleryFilterMenuEventArgs e)
{
e.FilterMenu.ItemLinks[n].Caption = "所有皮肤"; //n=分组数+1
}
//GalleryInitDropDownGallery事件设置弹出皮肤列表的表头“ALL Groups”为中文
private void rgbiSkins_GalleryInitDropDownGallery(object sender, InplaceGalleryEventArgs e)
{
e.PopupGallery.FilterCaption = "所有皮肤";
}
7.dockManager
将视图的状态信息保存到xml文件
dockManager1.SaveLayoutToXml("..//UserConfig//ViewInfo.xml");
导出xml中保存的状态信息
dockManager1.RestoreLayoutFromXml("..//UserConfig//ViewInfo.xml");
8.barManager
设置bar的字体与系统字体
barAndDockingController1.AppearancesBar.ItemsFont = new Font(this.Font.FontFamily, currentFontSize);
9.设置系统字体
DevExpress.Utils.AppearanceObject.DefaultFont = new Font(this.Font.FontFamily, currentFontSize);
10.treeView
为tree节点加右键菜单并选中该节点
private void treeList1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(e.Location);
if (hi.Node != null && hi.Node.ImageIndex == 5) //叶子节点的ImageIndex == 5
{
TreeListNode node = treeList1.FindNodeByID(hi.Node.Id);
treeList1.FocusedNode = node;
this.popupMenu1.ShowPopup(MousePosition);
}
}
}
delphi ribbon使用的更多相关文章
- delphi Ribbon 111
Ribbon上包含以下一些元素,如图所示: 元素对应API: Element Ribbon API Quick Access Toolbar RibbonControl.ToolbarRibbonQu ...
- delphi 实现Ribbon风格的窗体
随着office2007的兴起,微软让我们看到了Ribbon风格的窗体,现在很多软件也都开始使用Ribbon风格.那么我们如果要自己开发,应当怎么做呢?本文就是为大家解开这个疑团的. 首先,Delph ...
- delphi下实现ribbon界面的方法(一)
http://www.cnblogs.com/shanmx/archive/2011/12/04/2275213.html
- Ribbon_窗体_实现Ribbon风格的窗体
Ribbon_窗体_实现Ribbon风格的窗体 随着office2007的兴起,微软让我们看到了Ribbon风格的窗体,现在很多软件也都开始使用Ribbon风格.那么我们如果要自己开发,应当怎么做呢? ...
- Delphi资源大全
A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. Inspired by awe ...
- Awesome Delphi
Awesome Delphi A curated list of awesome Delphi frameworks, libraries, resources, and shiny things. ...
- delphi RAD Studio新版本及路线图 及官方网站 官方 版本发布时间
delphi RAD Studio Berlin 10.1 主要是FireMonkey 移动开发的改动,VCL确实没有多大变化. http://docwiki.embarcadero.com/RAD ...
- 【转】实现Ribbon风格的窗体
随着office2007的兴起,微软让我们看到了Ribbon风格的窗体,现在很多软件也都开始使用Ribbon风格.那么我们如果要自己开发,应当怎么做呢?本文就是为大家解开这个疑团的. 首先,Delph ...
- 学习笔记:7z在delphi的应用
最近做个发邮件的功能,需要将日志文件通过邮件发送回来用于分析,但是日志文件可能会超级大,测算下来一天可能会有800M的大小.所以压缩是不可避免了,delphi中的默认压缩算法整了半天不太好使,就看了看 ...
随机推荐
- slf4j MDC使用
slf4j MDC使用 最近也是在项目代码里发现一个地方有个MDC.put(),忍不住好奇点了进去,于是知道了MDC这个东西,细研究一下,发现还真是个好东西. MDC解决了什么问题 MDC全名Mapp ...
- DVWA的Xss跨站总结
Xss跨站总结 初级防护的代码 Poc:<script>alert(1)</script> 上图防护的代码 为输入的结果就为输出的结果 中级防护的代码 Poc:<scri ...
- InteliJ IDEA 简单使用:配置项目所需jdk
1:配置项目所需jdk: File->Project Structure 弹出如下界面: 首先选中SDKs,会出现下图界面:点击“+”标志弹出Add New SDK 然后选择JDK,会弹出路径框 ...
- jexus - 分析日志文件
1.统计IP访问次数 awk '{print $3}' default |sort -n|uniq -c|sort -rn|head
- Python学习笔记:算法的重要性
今日看了一个基础的教程<8分钟学会一个算法>,偶然间看到一个很简单的例子,仅当记录一下. 题目:已知a+b+c=1000,且a^2+b^2=c^2,求a,b,c的所有自然数解? #### ...
- Qt编程之悲惨世界
最近需要给人写点基于QtWebkit的代码,算是领教了Qt编程的痛苦之处. QNetworkConfigurationManager::isOnline() 只有在编译平台上能运行,拷贝到其他Wind ...
- .NetCore 分布式日志收集Exceptionless 在Windows下本地安装部署及应用实例
自己安装时候遇到很多问题,接下来把这些问题写出来希望对大家有所帮助 搭建环境: 1.下载安装 java 8 SDK (不要安装最新的10.0) 并配置好环境变量(环境变量的配置就不做介绍了) 2.下载 ...
- Swagger+IdentityServer4测试授权验证
1.Bearer授权操作,添加如下代码 services.AddSwaggerGen(options => { options.AddSecurityDefinition("Beare ...
- 从 prototype.js 深入学习 javascript 的面向对象特性
从 prototype.js 深入学习 javascript 的面向对象特性 js是一门很强大的语言,灵活,方便. 目前我接触到的语言当中,从语法角度上讲,只有 Ruby 比它更爽. 不过我接触的动态 ...
- Android 隐藏虚拟按键,并且全屏
/** * 隐藏虚拟按键,并且全屏 */protected void hideBottomUIMenu() { //隐藏虚拟按键,并且全屏 if (Build.VERSION.SDK_INT > ...