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 分布式架构之分布式缓存中间件
开源git地址: http://git.oschina.net/chejiangyi/XXF.BaseService.DistributedCache 分布式缓存中间件 方便实现缓存的分布式,集群, ...
- 问题记录:EntityFramework 一对一关系映射
EntityFramework 一对一关系映射有很多种,比如主键作为关联,配置比较简单,示例代码: public class Teacher { public int Id { get; set; } ...
- C++随笔:.NET CoreCLR之GC探索(3)
有几天没写GC相关的文章了哈,今天我讲GC的方式是通过一个小的Sample来讲解,这个小的示例代码只有全部Build成功了才会有.地址为D:\coreclr2\coreclr\bin\obj\Wind ...
- LINQ to SQL Select查询
1. 查询所有字段 using (NorthwindEntities context = new NorthwindEntities()) { var order = from n in contex ...
- 浅谈JSP中include指令与include动作标识的区别
JSP中主要包含三大指令,分别是page,include,taglib.本篇主要提及include指令. include指令使用格式:<%@ include file="文件的绝对路径 ...
- 【一起学OpenFOAM】03 OpenFOAM基本使用流程
OpenFOAM初学者常常对于软件的使用流程感到很迷惑,与其他的具有GUI的CFD软件不同,OpenFOAM的所有操作均为基于文本操作,譬如说里面各种计算模型.计算参数.流程控制参数等,均为通过修改对 ...
- 【腾讯Bugly干货分享】动态链接库加载原理及HotFix方案介绍
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/57bec216d81f2415515d3e9c 作者:陈昱全 引言 随着项目中动 ...
- React Native 环境搭建
1,安装 HomeBrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install ...
- 如何删除webstrom中生成的.idea wrokspace
首先说下遇到的问题,之前一直是通过webstrom来操纵github 以及git ,包括切换,生成分支,pull,push代码,这几天心血来潮 通过git代码进行了一次这些操作,然后当我在gitlab ...
- 解析大型.NET ERP系统 版本控制
数据库版本控制 1) 开发版本控制.控制多人同时修改数据库产生的冲突,使用SQL Source Control 工具做版本管理. SQL Server Management Studio支持VSS和T ...