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打印问题总结
在仓储系统的是使用过程中避免不了的是打印单据,仓库系统中包含很多单据:入库单,出库单,盘点单,调拨单,签收单等等,而且还附带着很多的条码标签的打印.本文在此记录一下一个简单的打印问题处理方式.处理问题 ...
随机推荐
- .net 分布式架构之任务调度平台
开源地址:http://git.oschina.net/chejiangyi/Dyd.BaseService.TaskManager .net 任务调度平台 用于.net dll,exe的任务的挂载, ...
- Mac OS、Ubuntu 安装及使用 Consul
Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...
- ASP.Net MVC4+Memcached+CodeFirst实现分布式缓存
ASP.Net MVC4+Memcached+CodeFirst实现分布式缓存 part 1:给我点时间,允许我感慨一下2016年 正好有时间,总结一下最近使用的一些技术,也算是为2016年画上一个完 ...
- Java定时任务的常用实现
Java的定时任务有以下几种常用的实现方式: 1)Timer 2)ScheduledThreadPoolExecutor 3)Spring中集成Cron Quartz 接下来依次介绍这几类具体实现的方 ...
- Objective-C枚举的几种定义方式与使用
假设我们需要表示网络连接状态,可以用下列枚举表示: enum CSConnectionState { CSConnectionStateDisconnected, CSConnectionStateC ...
- SpringMVC+Shiro权限管理【转】
1.权限的简单描述 2.实例表结构及内容及POJO 3.Shiro-pom.xml 4.Shiro-web.xml 5.Shiro-MyShiro-权限认证,登录认证层 6.Shiro-applica ...
- Android 关于ijkplayer
基于ijkplayer封装支持简单界面UI定制的视频播放器 可以解析ts格式的so库 怎样编译出可以解析ts等格式的so库?就是编译的时候需要在哪一步修改配置? 一些电视台的m3u8 CCTV1综合, ...
- Kafka1 利用虚拟机搭建自己的Kafka集群
前言: 上周末自己学习了一下Kafka,参考网上的文章,学习过程中还是比较顺利的,遇到的一些问题最终也都解决了,现在将学习的过程记录与此,供以后自己查阅,如果能帮助到其他人,自然是更好的. ...
- [C#版本]有趣啊!各种编程语言实现 2 + 2 = 5
首页新闻里面那个 [新闻头条]有趣啊!各种编程语言实现 2 + 2 = 5 其他的就不评论的,但是其中C#版的 真是逗比啊...评论中各种吐槽有木有... static void Main (stri ...
- ABP(现代ASP.NET样板开发框架)系列之3、ABP分层架构
点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之3.ABP分层架构 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)” ...