DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

界面控件DevExpress WinForms v23.1新功能抢先看——支持系统强调色更改

来源:   发布时间:2023-06-06   浏览:605次

DevExpress WinForm 下一个主要版本(v23.1)将在6月份左右发布,本文将为大家介绍在早期访问预览版(EAP)中包含的新功能。

PS:DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForm能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!

获取DevExpress v22.2正式版下载

DevExpress技术交流群8:523159565      欢迎一起进群讨论

SVG皮肤中的系统和自定义强调色

一旦最终用户在微软Windows操作系统中更改强调色,DevExpress矢量皮肤现在可以改变相关的颜色,激活 WindowsFormsSettings.TrackWindowsAccentColor设置来启用该选项即可。

DevExpress WinForms v23.1新版图集
using DevExpress.Utils;
using DevExpress.XtraEditors;

static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
WindowsFormsSettings.TrackWindowsAccentColor = DefaultBoolean.True;
Application.Run(new Form1());
}

用户还可以指定自定义的强调色,并动态应用所需的外观。

DevExpress.XtraEditors.WindowsFormsSettings.SetAccentColor(Color.FromArgb(16,124,65));

"The Bezier" 皮肤支持二级强调色,使用WindowsFormsSettings.SetAccentColor2方法指定第二个强调色。

WindowsFormsSettings.TrackWindowsAccentColor设置不与高对比度皮肤一起工作。

Windows操作系统中支持默认应用模式

有了这个新功能,用户的 Windows Forms 应用程序可以根据Microsoft Windows中的默认应用模式设置自动应用浅色或深色调色板(在皮肤库中仅显示浅色或深色调色板)。

DevExpress WinForms v23.1新版图集

使用WindowsFormsSettings.TrackWindowsAppMode属性来启用此功能。

using DevExpress.XtraEditors;

static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
WindowsFormsSettings.TrackWindowsAppMode = DevExpress.Utils.DefaultBoolean.True;
Application.Run(new Form1());
}

*可用于WXI,基本和Bezier皮肤。

WinForms Lookup Editor中的多项目选择

WinForms Lookup Editor支持多项选择模式。当使用时,查找显示一个复选框选择器列,并允许用户轻松地选择多个项目。用户还可以指定查找如何存储所选项:作为对象列表或CSV字符串。

DevExpress WinForms v23.1新版图集

新的API包括:

  • EditValueType - 启用多项选择模式,并指定查找如何存储所选项。
  • CheckBoxSelectorMember - 指定数据源中具有所选项状态的字段名称。
  • SelectionChanging - 当用户在下拉菜单中选择项目之前发生,并允许您取消该操作。
  • SelectionChanged - 当用户在下拉菜单中选择项后发生。
WinForms Ribbon UI — Office 365样式

WinForms Ribbon控件附带了一种新的Office 365渲染样式。

当使用全新的Office 365样式时,Ribbon控件会在Ribbon表单的顶部显示一个搜索框,并在Ribbon UI的右下方显示Ribbon选项。

DevExpress WinForms v23.1新版图集
using DevExpress.XtraBars.Ribbon;

ribbonControl.RibbonStyle = RibbonControlStyle.Office365;

使用以下API在其他功能区样式中启用新的UI增强功能:

  • RibbonControl.OptionsExpandCollapseMenu - 获取 "Show Ribbon"的可用性和操作设置。
  • RibbonControl.ExpandCollapseMenuShowing - 允许开发者自定义"Show Ribbon"菜单或根据特定条件阻止其显示。
  • RibbonControl.SearchItemPosition - 指定“搜索”框的位置。
在Ribbon消息栏中显示提醒

v23.1中实现了新的API来显示受Office启发的弹出式通知和警报。

DevExpress WinForms v23.1新版图集
using DevExpress.XtraBars.Ribbon;

void ShowMessage() {
RibbonMessageArgs args = new RibbonMessageArgs();
args.Caption = "What's New";
args.Text = "Explore new WinForms-related features we expect to introduce in our first major update this year (v23.1).";
args.Icon = MessageBoxIcon.Information;
args.Buttons = new DialogResult[] { DialogResult.OK };
args.Showing += Args_Showing;
Ribbon.ShowMessage(args);
Ribbon.MessageClosed += Ribbon_MessageClosed;
}
void Ribbon_MessageClosed(object sender, RibbonMessageClosedArgs e) {
if(e.Result == DialogResult.OK)
Data.Utils.SafeProcess.Start("https://community.devexpress.com/blogs/winforms/archive/2023/02/16/devexpress-winforms-roadmap-23-1.aspx");
}
void Args_Showing(object sender, RibbonMessageShowingArgs e) {
e.Buttons[DialogResult.OK].Caption = "Explore Roadmap";
}

新的API包括:

  • RibbonControl.ShowMessage - 在消息栏中显示消息。
  • RibbonControl.CloseMessage - 关闭指定的消息。
  • RibbonControl.MessageClosed - 在消息关闭后发生,并允许您处理按钮单击。
  • RibbonControl.Messages - 获取消息栏中显示的消息集合。

更多DevExpress线上公开课、中文教程资讯请上中文网获取

DevExpress企业定制服务
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/3829.html

相关产品: DevExpress Universal Subscription,

在线
客服
微信
QQ 电话
023-68661681
返回
顶部