DEV NavBarControl控件Item的使用

更新时间:2024-03-19 07:25:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

当单击NavBarItems 的时候,设置其背景色的改变。 1、

直接使用

NavigationPane 属性可以实现,但是要设

置 NavBarControl.AllowSelectedLink属性为true, 2、

当使用default SkinExplorerBarVie属性时,直接设置背景颜色,或者是高亮显示,将不会成功,方法是在CustomDrawLink 事件中自定义实现。

private void navBarControl1_CustomDrawLink(object sender,

DevExpress.XtraNavBar.ViewInfo.CustomDrawNavBarElementEventArgs e) { DevExpress.XtraNavBar.ViewInfo.NavLinkInfoArgs info = e.ObjectInfo as DevExpress.XtraNavBar.ViewInfo.NavLinkInfoArgs; if(info.State

==

DevExpress.Utils.Drawing.ObjectState.Selected

|

info.State == DevExpress.Utils.Drawing.ObjectState.Pressed){ e.Graphics.FillRectangle(Brushes.Red, e.ObjectInfo.Bounds); e.Graphics.DrawImage(e.Image, info.ImageRectangle); e.Appearance.DrawString(e.Cache, info.CaptionRectangle); e.Handled = true; } }

3、当PaintStyleKind 属性设置为ExplorerBar的时候,进行下面的设置不成功。

info.Link.Caption,

NavBarControl --> Appearance --> ItemPressed --> Image NavBarGroup --> AppearancePressed --> Image NavBarItem --> AppearancePressed --> Image

The background image simply does not appear. AllowSelectedLink is set to True. 3、

设置图片

如果要设置背景图片需要关闭皮肤机制,设置NavBarControl.LookAndFeel.UseDefaultLookAndFeel属性 为“false”同时设置 NavBarControl.LookAndFeel.Style 属性为“Flat”

Color highlight =

CommonSkins.GetSkin(this.navBarControl1).Colors[CommonColors.Highlight];

在ExplorerBar 样式时工作良好,但是在PaneView需要通过事件设置。

本文来源:https://www.bwwdw.com/article/act8.html

Top