Devexpress Ribbon Add Logo
一直在网上找类似的效果.在Devpexress控件里面的这个是一个Demo的.没法查看源代码.也不知道怎么写的.所以就在网上搜索了半天的.
终于找到类似的解决办法.
可以使用重绘制的办法的来解决.
[DesignerCategory("")]
[Designer("")]
public class RibbonLogoHelper : Component
{
private Image _Image;
private RibbonControl _RibbonControl; public RibbonControl RibbonControl
{
get { return _RibbonControl; }
set
{
if (value == _RibbonControl)
return;
RibbonControl prevValue = _RibbonControl;
_RibbonControl = value;
OnRibbonChanged(prevValue, _RibbonControl);
}
} private void OnRibbonChanged(RibbonControl prevValue, RibbonControl ribbonControl)
{
if (prevValue != null)
prevValue.Paint -= ribbonControl_Paint;
if (ribbonControl != null)
{
ribbonControl.Paint += ribbonControl_Paint;
ribbonControl.Invalidate();
} } void ribbonControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawRibbonLogo(e.Graphics);
} public Image Image
{
get { return _Image; }
set
{
if (value == _Image)
return;
_Image = value;
OnImageChanged();
}
} private void OnImageChanged()
{
if (RibbonControl != null)
RibbonControl.Invalidate();
} private void DrawRibbonLogo(Graphics graphics)
{
if (Image == null)
return;
RibbonViewInfo ribbonViewInfo = RibbonControl.ViewInfo;
if (ribbonViewInfo == null)
return;
RibbonPanelViewInfo panelViewInfo = ribbonViewInfo.Panel;
if (panelViewInfo == null)
return;
Rectangle bounds = panelViewInfo.Bounds;
int minX = bounds.X;
RibbonPageGroupViewInfoCollection groups = panelViewInfo.Groups;
if (groups == null)
return;
if (groups.Count > )
minX = groups[groups.Count - ].Bounds.Right;
if (bounds.Height < Image.Height)
return;
int offset = (bounds.Height - Image.Height) / ;
int width = Image.Width + ;
bounds.X = bounds.Width - width;
if (bounds.X < minX)
return;
bounds.Width = width;
bounds.Y += offset;
bounds.Height = Image.Height;
graphics.DrawImage(Image, bounds.Location);
} }
最终达到自己想要效果的.
或者在标题栏上添加类似的Logo
DevExpress.XtraBars.Ribbon.ViewInfo.RibbonViewInfo ribbonViewInfo = ribbonControl1.ViewInfo;
if (ribbonViewInfo == null)
return;
DevExpress.XtraBars.Ribbon.ViewInfo.RibbonCaptionViewInfo captionViewInfo = ribbonViewInfo.Caption;
if (captionViewInfo == null)
return; Rectangle bounds = new Rectangle(captionViewInfo.ContentBounds.X + , captionViewInfo.ContentBounds.Y,
captionViewInfo.ContentBounds.Width - , captionViewInfo.ContentBounds.Height);
Image image = DevExpress.Utils.Frames.ApplicationCaption8_1.GetImageLogoEx(LookAndFeel); e.Graphics.DrawImage(image, bounds.Location);
Devexpress Ribbon Add Logo的更多相关文章
- Devexpress Ribbon 动态生成菜单
/// <summary> /// 动态加载菜单 /// </summary> private void GetMenuBind() { //根据登录用户角色菜单动态创建 // ...
- DevExpress Ribbon右上角button显示文本设置
设置ribboncontrol.ShowItemCaptionsInPageHeader 属性为true
- Devexpress Ribbon
http://www.cnblogs.com/liwei81730/archive/2011/12/21/2296203.html 可查看此处.
- Devexpress VCL Build v2015 vol 15.1.2发布
2015年马上过半年了.终于第一个大版出来了. What's New in 15.1.2 (VCL Product Line) New Major Features in 15.1 What's ...
- Devexpress VCL Build v2013 vol 14.1.3 发布
我修,我修,修修修. New Major Features in 14.1 What's New in VCL Products 14.1 Breaking Changes To learn abou ...
- DevExpress VCL 13.1.2 发布
DevExpress VCL 的2013 第一个公开版发布, 基本上就是一些维护,没有大的变化,也没有FM 的支持. What's New in DevExpress VCL 13.1.2 Rel ...
- 向现有mvc程序中加入devexpress report
Open your ASP.NET MVC project. In the main menu of Visual Studio, click the DEVEXPRESS submenu and s ...
- CSLA框架的codesmith模板改造
一直有关注CSLA框架,最近闲来无事,折腾了下,在最新的r3054版本基础上修改了一些东西,以备自己用,有兴趣的园友可以下载共同研究 1.添加了默认的授权规则 如果是列表对象则生成列表权限,User的 ...
- 吉特仓库管理系统-.NET打印问题总结
在仓储系统的是使用过程中避免不了的是打印单据,仓库系统中包含很多单据:入库单,出库单,盘点单,调拨单,签收单等等,而且还附带着很多的条码标签的打印.本文在此记录一下一个简单的打印问题处理方式.处理问题 ...
随机推荐
- Shell碎碎念
1. 字符串如何大小写转换 str="This is a Bash Shell script." 1> tr方式 newstr=`tr '[A-Z]' '[a-z]' < ...
- Entity Framework 手动使用migration里面的up 和down方法。
add-migration -IgnoreChanges 201606100717405_201606100645298_InitialCreate 执行这一句后 ,清空使用map生成的代码,个人不太 ...
- 初学seaJs模块化开发,利用grunt打包,减少http请求
原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...
- 走进缓存的世界(三) - Memcache
系列文章 走进缓存的世界(一) - 开篇 走进缓存的世界(二) - 缓存设计 走进缓存的世界(三) - Memcache 简介 Memcache是一个高性能的分布式内存对象缓存系统,用于动态Web应用 ...
- 负载均衡——nginx理论
nginx是什么? nginx是一个强大的web服务器软件,用于处理高并发的http请求和作为反向代理服务器做负载均衡.具有高性能.轻量级.内存消耗少,强大的负载均衡能力等优势. nginx架构? ...
- 听H3絮叨:何以让天下没有难用的流程
最近朋友圈.网站新闻铺天盖地是"让天下没有难用的流程",有人就要问了,H3 BPM何德何能,为BPM站台,让天下没有难用的流程? 这是一个关于"办公室空想"的故 ...
- Atitit 软件工程概览attilax总结
Atitit 软件工程概览attilax总结 1.1. .2 软件工程的发展 进一步地,结合人类发展史和计算机世界演化史来考察软件工程的发展史. 表2 软件工程过程模型 表2将软件工程的主要过程模型做 ...
- 烂泥:wiki系统confluence5.6.6安装、中文、破解及迁移
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb confluence是一个专业的企业知识管理与协同软件,可以用于构建企业wiki.通过它 ...
- 山寨Unity3D?搜狐畅游的免费开源游戏引擎Genesis-3D
在CSDN上看到了<搜狐畅游发布3D游戏引擎Genesis-3D 基于MIT协议开源>(http://www.csdn.net/article/2013-11-21/2817585-cha ...
- 关于我 — About Me
个人简介 姓名:周旭龙 关注:.NET开发技术.Web前端技术 邮箱:edisonchou@hotmail.com GitHub: https://github.com/edisonchou 主要经历 ...